local active = false
local savedPos = {0, 0, 0}
function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand('tp0', function()
        active = not active
        if active then
            savedPos = {getCharCoordinates(PLAYER_PED)}
            setCharCoordinates(PLAYER_PED, 0, 0, 10)
        else
            setCharCoordinates(PLAYER_PED, savedPos[1], savedPos[2], savedPos[3])
        end
    end)
    wait(-1)
end
local sampev = require 'lib.samp.events'
function sampev.onSendPlayerSync()
    return not active
end