Skip to content

Instantly share code, notes, and snippets.

@Python1320
Created August 14, 2014 20:49
Show Gist options
  • Save Python1320/8cd05fd2083c9cad27e3 to your computer and use it in GitHub Desktop.
Save Python1320/8cd05fd2083c9cad27e3 to your computer and use it in GitHub Desktop.
--do return print(util.SteamIDTo64("STEAM_0:1:1")) end
local fSid=file.Open("hac_sids.dat",'rb','DATA')
local fReasons=file.Read("hac_reason.dat",'DATA')
local reasons = {}
local lastpos=1
require'vstruct'
collectgarbage"collect"
local start=collectgarbage"count"
for i=0,99999 do
local startpos,endpos = fReasons:find("\0",lastpos,true)
if not startpos then break end
local str=fReasons:sub( lastpos,endpos - 1)
lastpos=startpos and endpos + 1
table.insert(reasons,str)
end
local first=reasons[1]
table.remove(reasons,1)
reasons[0]=first
local upper32 = BigNum.new"76561197960265728"
local hacs = {}
function IsHACBanned(sid32)
local X,Y,Z=sid32:match("^STEAM%_(%d):(%d):(%d+)$")
if not Z then error("Invalid SteamID32: "..tostring(sid32),2) end
local account_id = ( bit.lshift(Z,1) ) + Y
local idx = hacs[account_id]
return reasons[idx] or idx
end
for i=0,9999 do
local dat,dat2 = fSid:Read(4),fSid:Read(2)
if not dat or not dat2 then break end
local lower32 = vstruct.read("<u4",dat)[1]
local idx = vstruct.read("u2",dat2)[1]
hacs[lower32] = idx
local sid64 = upper32 + ( BigNum.new(lower32) )
sid64 = tostring(sid64)
assert(util.SteamIDTo64(util.SteamIDFrom64(sid64)) == sid64,lower32)
hacs[lower32]=idx
end
--collectgarbage"collect"
collectgarbage"collect"
local ending=collectgarbage"count"
print(ending-start)
--print(IsHACBanned("STEAM_0:1:35199736"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment