function main()
repeat wait(0) until isSampAvailable()
sampRegisterChatCommand("test", function()
on = not on
end)
while true do wait(0)
if on then
lockPlayerControl(true)
freezeCharPosition(PLAYER_PED, true)
sampSetCursorMode(4)
else
lockPlayerControl(false)
freezeCharPosition(PLAYER_PED, false)
sampSetCursorMode(0)
end
end
end