IsElementInAir

From Multi Theft Auto: Wiki
Revision as of 17:23, 19 October 2021 by Hydra (talk | contribs) (Created page with "==Syntax== <syntaxhighlight lang="lua"> bool isElementInAir ( element theElement ) </syntaxhighlight> ===Returns=== Returns true if the element is in air, false otherwise. =...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Syntax

 bool isElementInAir ( element theElement ) 

Returns

Returns true if the element is in air, false otherwise.

Code

function isElementInAir(element)
    local x, y, z = getElementPosition(element)
    if element and isElement(element) then 
        if z >= 10 then
           return z
        end
    end
end

Example

Click to collapse [-]
Client

This script tells if the player is in air or not.

function checkAir()
   if isElementInAir(localPlayer) then
      outputChatBox("Indeed it is")
   else
      outputChatBox("Nope")
   end
end
addCommandHandler("air", checkAir)