Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Ban, UnBan
- function Ban(event, pPlayer, pMessage, pType, pLanguage, pMisc)
- local msg = pMessage:lower
- if(msg:find("[.!]Ban .+ %d+")) then
- local Name, Time = msg:match("[.!]Ban (%a*) (%d*)") -- Time = Minutes
- local Current = os.date("!*t")
- Current.min = Current.min+Time
- local expire = os.time(Current)
- WorldDBQuery("UPDATE system SET banned = 1, expiredate = "..expire.." WHERE Player = '"..Name.."';")
- CreateLuaEvent(function() UnBan(Name) end, Time*60000, 1)
- return false
- end
- end
- function UnBan(Name)
- WorldDBQuery("UPDATE system SET banned = 0 WHERE Player = '"..Name.."';")
- end
- do
- local Q = WorldDBQuery("SELECT expiredate, Player FROM system WHERE banned <> 0;")
- if(Q) then
- local Time = os.time()
- for i = 1, Q:GetRowCount() do
- local expire, Name = Q:GetColumn(0):GetULong(), Q:GetColumn(1):GetString()
- if(expire <= Time) then
- UnBan(Name)
- else
- CreateLuaEvent(function() UnBan(Name) end, (expire-Time)*1000, 1)
- end
- end
- end
- end
- RegisterServerHook(16, Ban)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement