So i need a script to read the altitude of planes from ground level, does anyone have one?
Like to tell a pilot their altitude or for ground players to see others altitude.
1 Like
I think you want something like this, you just need to add the plane names into the aircraft table as strings and it should work… should.
local aircraft = {} -- Add plane models here
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local playerPed = GetPlayerPed(-1)
if IsPedInAnyVehicle(playerPed, false) then
local vehicle = GetVehiclePedIsIn(playerPed, false)
if IsVehicleAPlane(GetEntityModel(vehicle)) then
drawTxt(0.555, 0.712, 1.0, 1.0, 0.4, GetEntityHeightAboveGround(vehicle), 225, 225, 225, 255, 4)
end
end
end
end)
function IsVehicleAPlane(vehicle)
for k,v in pairs(aircraft) do
if v == vehicle then
return true
end
end
return false
end
function drawTxt(x, y, width, height, scale, text, r, g, b, a, font)
SetTextFont(font)
SetTextProportional(0)
SetTextScale(scale, scale)
SetTextColour(r, g, b, a)
SetTextDropShadow(0, 0, 0, 0,255)
SetTextEdge(2, 0, 0, 0, 255)
SetTextDropShadow()
SetTextOutline()
SetTextEntry("STRING")
AddTextComponentString(text)
DrawText(x - width/2, y - height/2 + 0.005)
end
Can you send the files please i dont know how to put that in a script
I tried this, it doesn’t work