function main()
while true do wait(0)
if wasKeyPressed(0x5A) and not sampIsCursorActive() then
if isCharInAnyCar(PLAYER_PED) then
freezeCarPosition(storeCarCharIsInNoSave(PLAYER_PED), false)
else
setPlayerControl(PLAYER_HANDLE, true)
freezeCharPosition(PLAYER_PED, false) clearCharTasksImmediately(PLAYER_PED)
end
end
end
end