local sandbox_sandbox_active = false
local savedCoords = {x = 0, y = 0, z = 0}, heading = 0}
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(0) end
sampRegisterChatCommand("sandbox",toggle)
wait(-1)
end
function onSendPacket(id)
if sandbox_active then
return false
end
end
function onSendRpc(id)
if sandbox_active then
return false
end
end
function onScriptTerminate(s, q)
if s == thisScript() and sandbox_active then
toggle()
end
end
function toggle()
if sandbox_active then
if isCharInAnyCar(PLAYER_PED) then
warpCharFromCarToCoord(PLAYER_PED, savedCoords.x, savedCoords.y, savedCoords.z)
else
setCharCoordinates(PLAYER_PED, savedCoords.x, savedCoords.y, savedCoords.z)
end
setCharHeading(PLAYER_PED, savedCoords.heading)
sandbox_active = false
else
sandbox_active = true
savedCoords.x, savedCoords.y, savedCoords.z = getCharCoordinates(PLAYER_PED)
savedCoords.heading = getCharHeading(PLAYER_PED)
end
end