local ffi = require"ffi"
local CompetitiveMatchAPI = Panorama.Open().CompetitiveMatchAPI
local client_state = ffi.cast("uintptr_t**", ffi.cast("uint8_t*",Utils.PatternScan("engine.dll", "A1 ? ? ? ? 8B 80 ? ? ? ? C3")) + 1)[0][0]
local m_nSignonState = ffi.cast("int32_t*", client_state+0x108)
local is_patched = false
local ts = {}
local function delayCall(time, callback, ...)
table.insert(ts, {time = time,timestep=GlobalVars.realtime, callback = callback, args = {...}})
end
function gogogo()
m_nSignonState[0] = 6
end
local function set_signon_state_loop()
if not is_patched then
delayCall(0.1, set_signon_state_loop)
end
if not is_patched and m_nSignonState[0] > 5 then
m_nSignonState[0] = 5
is_patched = true
delayCall(2.2, gogogo)
end
EngineClient.ExecuteClientCmd("joingame")
end
Cheat.RegisterCallback("frame_stage", function()
for _, value in ipairs(ts) do
local realtime = GlobalVars.realtime
if (realtime-value.time)>=value.timestep then
value.callback(unpack(value.args))
table.remove(ts,_)
end
end
end)
Menu.Button("Teleport", "Teleport", "Teleport", function()
EngineClient.ExecuteClientCmd("disconnect")
is_patched = false
CompetitiveMatchAPI.ActionReconnectToOngoingMatch()
set_signon_state_loop()
end)