IsElementOnFire: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
 
Line 16: Line 16:


==Example==
==Example==
{{Needs Example}}
Creates a command that checks if the player is on fire or not.
<section name="Server" class="server" show="true">
<syntaxhighlight lang="lua">
function checkPlayerFire(thePlayer)
    if isElementOnFire(thePlayer) then
        outputChatBox("So hot!", thePlayer, 255, 50, 0)
    else
        outputChatBox("You're cool. No flames detected.", thePlayer, 0, 255, 0)
    end
end
addCommandHandler("checkfire", checkPlayerFire)
</syntaxhighlight>
</section>


==See Also==
==See Also==
{{Element functions}}
{{Element functions}}

Latest revision as of 11:13, 30 June 2025

ADDED/UPDATED IN VERSION 1.6.0 r22864:
This function checks if the specified element is on fire or not.

Syntax

bool isElementOnFire ( element theElement )

OOP Syntax Help! I don't understand this!

Method: element:isOnFire(...)
Variable: .onFire
Counterpart: setElementOnFire


Required Arguments

Returns

Returns true if the element is on fire, false otherwise.

Example

Creates a command that checks if the player is on fire or not.

Click to collapse [-]
Server
function checkPlayerFire(thePlayer)
    if isElementOnFire(thePlayer) then
        outputChatBox("So hot!", thePlayer, 255, 50, 0)
    else
        outputChatBox("You're cool. No flames detected.", thePlayer, 0, 255, 0)
    end
end
addCommandHandler("checkfire", checkPlayerFire)

See Also