View difference between Paste ID: ARzUUH4W and EFdhChDv
SHOW: | | - or go back to the newest paste.
1
require("tmysql")
2
local Host, User, Pass, DB, Port = "", "", "", "", 3306
3
4
tmysql.initialize( Host, User, Pass, DB, Port )
5
6
function SQLHandle( result, _, error )
7
	if error and error != 0 then
8
		print( "SQL ERROR: " .. error )
9
	end
10-
				tmysql.query("UPDATE `sb_bans` WHERE `name`='" .. n .. "', `cid`='" .. cid .. "'")
10+
end
11
12
hook.Add("PlayerPasswordAuth" "CheckBans", function( n, p, s, i )
13
	tmysql.query("SELECT `authid`, FROM_UNIXTIME(`ends`,"%Y-%m-%d"), `length`, `reason`, FROM `sb_bans`", function( baninfo )
14
		if baninfo[1][1] and os.time() >= baninfo[1][2] then
15-
end)
15+
16
			Msg(n .. "[" .. s .. "] was unbanned, reason their ban expired.")
17
		elseif baninfo[1][1] and os.time() <= baninfo[1][2] then
18
			if baninfo[1][3] == 0 then
19
				return {false, "Your permantly banned from our server(s).\n" .. baninfo[1][4] }
20
			else
21
				return {false, "Your banned for " .. baninfo[1][2] .. " minutes.\n" .. reason }
22
			end
23
		end
24
	end)
25
end)
26
27
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' )