-- Checks the altitude of the Deluxo and locks its current mode when above 150 meters.
-- If the Deluxo is in flying mode at this altitude, it will be unable to switch to driving mode, and vice versa.
Citizen.CreateThread(function()
local coords -- Variable to store the vehicle's coordinates.
local vehicle -- Variable to store the vehicle entity.
repeat
vehicle = GetVehiclePedIsIn(PlayerPedId(), false) -- Get the vehicle the player is currently in.
if (GetEntityModel(vehicle) == joaat("deluxo")) then -- Check if the vehicle is a Deluxo.
coords = GetEntityCoords(vehicle) -- Get the current coordinates of the vehicle.
end
Citizen.Wait(0) -- Wait for the next frame.
until coords.z >= 150.0 -- Keep looping until the Deluxo is above 150 meters.
SetSpecialFlightModeAllowed(vehicle, false) -- Lock the Deluxo's current mode (flying or driving).
end)