Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- This uses gate keeper. This hook is called as soon as the server receives name, (pass), steamid, ip. Called before PlayerConnect and PlayerAuth. This hook checks for bans and either unbans them or drops them. It also checks to see if the server is full(maxslots - 6) and checks if their vip and allows connection or if not vip denies access and drops them.
- --]]
- hook.Add("PlayerPasswordAuth" "CheckBans", function( n, p, s, i )
- local ban, vip = tmysql.query("SELECT * `bans`"), tmysql.query("SELECT * `vips`")
- local admin, name, steam, reason, time, vsteam, cid = ban[1][1], ban[1][2], ban[1][3], ban[1][4], ban[1][5], vip[1][1], GetCID( s )
- if steam and os.time() >= time then
- tmysql.query("DELETE `bans` WHERE `steamid`='" .. s .. "'")
- Msg(n .. "[" .. s .. "] was unbanned, reason their ban expired.")
- elseif steam then
- if time == 0 then
- return {false, "Your permantly banned from our server(s).\n" .. reason }
- else
- tmysql.query("UPDATE `bans` WHERE `name`='" .. n .. "', `cid`='" .. cid .. "'")
- return {false, "Your banned for " .. time - os.time() .. " minutes.\n" .. reason }
- end
- elseif GetConVar("Maxplayers") - 6 >= gatekeeper.GetNumClients().total then
- if vsteam == s then
- Msg("[VIP][ " .. n .. " | " .. s .. " ] has joined.")
- else
- return {false, "Server is full.\nBuy vip to get reserved slot." }
- end
- end
- end)
- --[[
- http://steamcommunity.com/profiles/7656119xxxxxxxxxx
- steam://friends/add/7656119xxxxxxxxxx
- --]]
- function GetCID( steamid )
- -- Credit Overv(Evolve Admin Mod)
- local x, y, z = string.match( steamid, "STEAM_(%d+):(%d+):(%d+)" )
- if x and y and z then
- local friendid = string.format( "765%0.f", z * 2 + 61197960265728 + y )
- return friendid
- else
- return steamid
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement