Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MeanSeaLevel = 0.5
- Citizen.CreateThread(function()
- while true do
- Citizen.Wait(0)
- local PlayerRef = GetPlayerPed(-1)
- if (IsPedSittingInAnyVehicle(PlayerRef)) then
- local PlaneRef = GetVehiclePedIsIn(PlayerRef, false)
- local PlaneX, PlaneY, PlaneZ = table.unpack(GetEntityCoords(PlaneRef))
- local Altitude = GetEntityHeight(PlaneRef, PlaneX, PlaneY, -MeanSeaLevel, true, true)
- -- Basically the same as PlaneZ + MeanSeaLevel buuuuuuuuuuuuuuuut oh well
- drawTxt("ALT (meters): " .. roundInt(Altitude, 1) .. " (feet): " .. roundInt(Altitude * 3.28084, 1))
- else
- drawTxt("ALT: No Data")
- end
- end
- end)
- function roundInt(num, numDecimalPlaces)
- local mult = 10^(numDecimalPlaces or 0)
- return math.floor(num * mult + 0.5) / mult
- end
- function drawTxt(text)
- SetTextFont(0)
- SetTextProportional(1)
- SetTextScale(0.0, 0.3)
- SetTextColour(255, 255, 255, 255)
- SetTextDropshadow(0, 0, 0, 0, 255)
- SetTextEdge(1, 0, 0, 0, 255)
- SetTextDropShadow()
- SetTextOutline()
- SetTextEntry("STRING")
- AddTextComponentString(text)
- DrawText(0.005, 0.005)
- end
Add Comment
Please, Sign In to add comment