Hello, I tried making a script that would show plane and helicopter blips of players that are currently flying in either aircraft. Also, on the pause menu map, the blip shows the numberplate of the vehicle the player is in. I failed miserably and my code is probably shit. Any ideas?
Citizen.CreateThread(function()
while true do
Citizen.Wait(1)
for id = 0, 64 do
if NetworkIsPlayerActive(id) and GetPlayerPed(id) ~= GetPlayerPed(-1) then
ped = GetPlayerPed(id)
blip = GetBlipFromEntity(ped)
veh = GetVehiclePedIsIn( ped, false )
if IsPedInAnyPlane(ped) then
SetBlipDisplay(blip, 2)
SetBlipSprite( blip, 423)
BeginTextCommandSetBlipName(blip)
AddTextComponentSubstringPlayerName(GetVehicleNumberPlateText(veh))
EndTextCommandSetBlipName(blip)
Citizen.InvokeNative( 0x5FBCA48327B914DF, blip, false )
else if IsPedInAnyHeli(ped) then
SetBlipDisplay(blip, 2)
SetBlipSprite( blip, 424)
BeginTextCommandSetBlipName(blip)
AddTextComponentSubstringPlayerName(GetVehicleNumberPlateText(veh))
EndTextCommandSetBlipName(blip)
Citizen.InvokeNative( 0x5FBCA48327B914DF, blip, false )
end
SetBlipRotation( blip, math.ceil( GetEntityHeading( veh ) ) )
SetBlipScale( blip, 0.85 )
end
end
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(1)
for id = 1, 64, 1 do
if NetworkIsPlayerActive(id) and GetPlayerPed(id) ~= GetPlayerPed(-1) then
ped = GetPlayerPed(id)
blip = GetBlipFromEntity(ped)
veh = GetVehiclePedIsIn( ped, false )
if IsPedInAnyPlane(ped) then
SetBlipDisplay(blip, 2)
SetBlipSprite( blip, 423)
BeginTextCommandSetBlipName(blip)
AddTextComponentSubstringPlayerName(GetVehicleNumberPlateText(veh))
EndTextCommandSetBlipName(blip)
ShowHeadingIndicatorOnBlip(blip, false)
else if IsPedInAnyHeli(ped) then
SetBlipDisplay(blip, 2)
SetBlipSprite( blip, 424)
BeginTextCommandSetBlipName(blip)
AddTextComponentSubstringPlayerName(GetVehicleNumberPlateText(veh))
EndTextCommandSetBlipName(blip)
ShowHeadingIndicatorOnBlip(blip, false)
end
SetBlipRotation( blip, math.ceil( GetEntityHeading( veh ) ) )
SetBlipScale( blip, 0.85 )
end
end
end
end)
This script loads, but it just creates 1437 of the same yellow circle “Destination” blips. I need it to show blips only for players in aircraft… any ideas?
local blip
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
for id = 1, 64, 1 do
if NetworkIsPlayerActive(id) and GetPlayerPed(id) ~= GetPlayerPed(-1) then
ped = GetPlayerPed(id)
veh = GetVehiclePedIsIn( ped, false )
pos = GetEntityCoords(GetPlayerPed(-1))
blip = AddBlipForCoord(pos.x, pos.y, pos.z)
if IsPedInAnyPlane(ped) then
SetBlipSprite( blip, 423)
SetBlipDisplay(blip, 2)
BeginTextCommandSetBlipName("String")
AddTextComponentSubstringPlayerName(GetVehicleNumberPlateText(veh))
EndTextCommandSetBlipName(blip)
ShowHeadingIndicatorOnBlip(blip, false)
elseif IsPedInAnyHeli(ped) then
SetBlipSprite( blip, 424)
SetBlipDisplay(blip, 2)
BeginTextCommandSetBlipName("String")
AddTextComponentSubstringPlayerName(GetVehicleNumberPlateText(veh))
EndTextCommandSetBlipName(blip)
ShowHeadingIndicatorOnBlip(blip, false)
end
SetBlipRotation( blip, math.ceil( GetEntityHeading(veh)))
SetBlipScale(blip, 0.9)
end
end
end
end)
Hello, I need help with a script that only shows blips of players in a plane or a heli on the pause menu map. Also the name of the player shown when clicking the blip must be replaced with the licenseplate number of the aircraft. Any help is appreciated. Thanks
The blip variable is undefined.
Also you need to break the loop because it executes for every player that has an id that’s between 1 and 64 and it never stops try usingIf instead of for.