Citizen.CreateThread(function()
Citizen.Wait(100)
while true do
local sleepThread = 500
local radarEnabled = IsRadarEnabled()
if not IsPedInAnyVehicle(PlayerPedId()) and radarEnabled then
DisplayRadar(false)
elseif IsPedInAnyVehicle(PlayerPedId()) and not radarEnabled then
DisplayRadar(true)
end
Citizen.Wait(sleepThread)
end
end)