[QUOTE=>>oubliette<<;42531057][url]http://wiki.teamfortress.com/wiki/WebAPI/GetPlayerBans[/url][/QUOTE]
Thank you. That was what i was looking for.
Maybe this will help
[lua]
local VACEnabled = CreateConVar("hac_vac", 1, false, false)
VAC_BANNED = 1001
NOT_BANNED = 1002
HAC.VACTries = {}
HAC.VACBanned = {}
HAC.VACKicked = {}
local function Retry(SID)
HAC.VACTries[ SID ] = (HAC.VACTries[ SID ] or 0) + 1
timer.Simple(3, function() HAC.CheckVACID(SID) end)
end
//VAC
function HAC.CheckVACID(SID)
local Res = HAC.VACTries[ SID ]
if Res and Res != VAC_BANNED and Res != NOT_BANNED and Res > 3 then
ErrorNoHalt("VACCheck: Tried 3 times for "..SID..", give up :(\n")
return
end
http.Fetch(
"http://api.steampowered.com/ISteamUser/GetPlayerBans/v0001/?key="..HAC.APIKey.."&format=json&steamids="..SID,
function(body)
body = util.JSONToTable(body)
if not body then
//No body
ErrorNoHalt("VACCheck: no body: "..SID.."\n")
Retry(SID)
return
end
if body.players and body.players[1] then
local Banned = tobool( body.players[1].VACBanned )
HAC.VACBanned[ SID ] = Banned
HAC.VACTries[ SID ] = Banned and VAC_BANNED or NOT_BANNED
else
//No player
ErrorNoHalt("VACCheck: no players: "..SID.."\n")
Retry(SID)
end
end,
function(code)
ErrorNoHalt("VACCheck: Failed HTTP for "..SID.." (Error: "..code..")\n")
//No connection, retry
Retry(SID)
end
)
end
//Spawn
function HAC.CheckVACSpawn(ply)
if ply:IsBot() then return end
local SID = ply:SteamID64()
HAC.CheckVACID(SID)
HAC.CheckProf(SID)
end
hook.Add("HACReallySpawn", "HAC.CheckVACSpawn", HAC.CheckVACSpawn)
//Log
local function LogPlayer(v,what)
local Cont = file.Read(what, "DATA")
local SID = v:SteamID64()
if Cont and Cont:find(SID) then return end
HAC.file.Append(what, Format('\n\t["%s"] = {"%s", "%s"},', SID, v:SteamID(), v:Nick() ) )
end
//Check
function HAC.CheckSteamAPI()
if HAC.Silent:GetBool() then return end
//VAC
for k,v in pairs( player.GetHumans() ) do
if v.DONEBAN or v.HAC_DoneVAC or v.VACBanned != nil or HAC.Banned[ v:SteamID() ] or not VACEnabled:GetBool() then continue end
local Res = HAC.VACBanned[ v:SteamID64() ]
if Res == nil then continue end
v.VACBanned = Res
v.HAC_DoneVAC = true
if not Res then continue end --not banned
LogPlayer(v, "vac_banned.txt")
//Kick
timer.Simple(10, function()
if IsValid(v) and v:HAC_InDB() then --Cheated here as well
local Lev = HAC.VACKicked[ SID ] or 0
v:HAC_Drop( HAC.Msg["VC_VAC_"..Lev] or HAC.Msg.VC_VAC_1 )
HAC.VACKicked[ SID ] = Lev + 1
end
end)
end
end
timer.Create("HAC.CheckSteamAPI", 5, 0, HAC.CheckSteamAPI)
[/lua]
Sorry, you need to Log In to post a reply to this thread.