Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require("tmysql")
- local Host, User, Pass, DB, Port = "", "", "", "", 3306
- tmysql.initialize( Host, User, Pass, DB, Port )
- function SQLHandle( result, _, error )
- if error and error != 0 then
- print( "SQL ERROR: " .. error )
- end
- end
- hook.Add("PlayerPasswordAuth" "CheckBans", function( n, p, s, i )
- tmysql.query("SELECT `authid`, FROM_UNIXTIME(`ends`,"%Y-%m-%d"), `length`, `reason`, FROM `sb_bans`", function( baninfo )
- if baninfo[1][1] and os.time() >= baninfo[1][2] then
- tmysql.query("DELETE sb_bans` WHERE `authid`='" .. s .. "'")
- Msg(n .. "[" .. s .. "] was unbanned, reason their ban expired.")
- elseif baninfo[1][1] and os.time() <= baninfo[1][2] then
- if baninfo[1][3] == 0 then
- return {false, "Your permantly banned from our server(s).\n" .. baninfo[1][4] }
- else
- return {false, "Your banned for " .. baninfo[1][2] .. " minutes.\n" .. reason }
- end
- end
- end)
- end)
- tmysql.query("INSERT INTO `sb_bans` (`ip`, `authid`, `name` `created`, `ends`, `length`, `reason`, `aid`, `sid`, `type`) VALUES( '" .. ply:IPAddress() .. "', '" .. ply:SteamID() .. "', '" .. ply:Nick() .. "', '" .. ply:Nick() .. "', '" .. os.time() .. "', '" .. os.time() + time .. "', '3', '0', '0' )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement