Jump to content

[Hud] [Help] Show text airplanes [solved]


Recommended Posts

Friends , I need this hud high, only appears when I'm in aircraft and helicopters , no cars and motorcycles .

If you do not understand , I want this text to appear when I get into some helicopter , type : sa4t9GT.png

My code:

  
addEventHandler ( "onClientRender", getRootElement(), function() 
    if isPedInVehicle(getLocalPlayer()) and isSpeedoEnabled == true then  
    local x,y,z = getElementPosition (getLocalPlayer()) 
     dxDrawText("ALT:", 707+2, 8+2, 773+2, 42+2, tocolor(0, 0, 0), 0.70, "bankgothic", "left", "top", false, false, true) 
     dxDrawText("ALT:", 707, 8, 773, 42, tocolor(67, 150, 39), 0.70, "bankgothic", "left", "top", false, false, true) 
         dxDrawText("" ..tostring(math.floor (z)).. "m",777+2, 10+2, 866+2, 42+2, tocolor(0, 0, 0), 0.70, "bankgothic", "left", "top", false, false, true) 
    dxDrawText("" ..tostring(math.floor (z)).. "m",777, 10, 866, 42, tocolor(67, 150, 39), 0.70, "bankgothic", "left", "top", false, false, true) 
      dxDrawImage(773+1, 4+1, 68+1, 34+1,"imgs/speeds.png", 0,0,0, tocolor(0, 0, 0)) 
    dxDrawImage(773, 4, 68, 34,"imgs/speeds.png", 0,0,0, tocolor(67, 150, 39)) 
        end 
end) 
  
  
  
function getElementSpeed(element,unit) 
    if (unit == nil) then unit = 0 end 
    if (isElement(element)) then 
        local x,y,z = getElementVelocity(element) 
        if (unit=="mph" or unit==1 or unit =='1') then 
            return math.floor((x^2 + y^2 + z^2) ^ 0.5 * 100) 
        else 
            return math.floor((x^2 + y^2 + z^2) ^ 0.5 * 100 * 1.609344) 
        end 
    else 
        return false 
    end 
end 
  

Edited by Guest
Link to comment

try this (tested) :wink:

  
addEventHandler ( "onClientRender", getRootElement(), function() 
    local Vehicle = getPedOccupiedVehicle(getLocalPlayer()) 
    if Vehicle then 
    local Type = getVehicleType(Vehicle) 
        if Type == "Plane" or Type == "Helicopter" then 
            local x,y,z = getElementPosition (getLocalPlayer()) 
            dxDrawText("ALT:", 707+2, 8+2, 773+2, 42+2, tocolor(0, 0, 0), 0.70, "bankgothic", "left", "top", false, false, true) 
            dxDrawText("ALT:", 707, 8, 773, 42, tocolor(67, 150, 39), 0.70, "bankgothic", "left", "top", false, false, true) 
            dxDrawText("" ..tostring(math.floor (z)).. "m",777+2, 10+2, 866+2, 42+2, tocolor(0, 0, 0), 0.70, "bankgothic", "left", "top", false, false, true) 
            dxDrawText("" ..tostring(math.floor (z)).. "m",777, 10, 866, 42, tocolor(67, 150, 39), 0.70, "bankgothic", "left", "top", false, false, true) 
            dxDrawImage(773+1, 4+1, 68+1, 34+1,"imgs/speeds.png", 0,0,0, tocolor(0, 0, 0)) 
            dxDrawImage(773, 4, 68, 34,"imgs/speeds.png", 0,0,0, tocolor(67, 150, 39)) 
        end 
    end 
     
end) 
  
function getElementSpeed(element,unit) 
    if (unit == nil) then unit = 0 end 
    if (isElement(element)) then 
        local x,y,z = getElementVelocity(element) 
        if (unit=="mph" or unit==1 or unit =='1') then 
            return math.floor((x^2 + y^2 + z^2) ^ 0.5 * 100) 
        else 
            return math.floor((x^2 + y^2 + z^2) ^ 0.5 * 100 * 1.609344) 
        end 
    else 
        return false 
    end 
end 
  

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...