Jump to content

How to get player vehicle health in Export.lua


Recommended Posts

Posted

Hi, I'm trying to get information about the damage state of the player's aircraft from within Export.lua, and can't seem to get this to work. In essence, I want to know if the player's aircraft has sustained *any* damage, or if it's undamaged.
 

    local playerPlaneId = LoGetPlayerPlaneId()
    local playerUnit = LoGetObjectById(playerPlaneId)

    if (playerUnit == false) then
        return
    end
    
    if (playerUnit:getLife() < playerUnit:getLife0()) then
        return
    end

This doesn't work because playerUnit doesn't have a function called getLife. This is probably the completely wrong way to try, I'd appreciate any help!

  • Recently Browsing   0 members

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