SetPedOnFire: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Added OOP syntax)
Line 17: Line 17:


==Example==  
==Example==  
This script will make all current connected players and peds to burn
This script will set player on fire when they fall into water.
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
     setPedOnFire ( getRootElement(), true )
addEventHandler("onClientResourceStart", getRootElement(),
</syntaxhighlight>
     function ()
        setTimer(  function()
                        if isElementInWater(getLocalPlayer()) then
                        setPedOnFire ( getLocalPlayer(), true )
                        end
                    end, 1000, 0)
    end
    )   
</syntaxhighlight></section>


==See Also==
==See Also==
{{Ped functions}}
{{Ped functions}}
[[ru:setPedOnFire]]
[[ru:setPedOnFire]]

Revision as of 18:46, 11 April 2015

This function can be used to set a ped on fire or extinguish a fire on it.

Syntax

bool setPedOnFire ( ped thePed, bool isOnFire )

OOP Syntax Help! I don't understand this!

Method: ped:setOnFire(...)
Variable: .onFire
Counterpart: isPedOnFire


Required Arguments

  • thePed: The ped that we want to set/unset
  • isOnFire: true to set the ped on fire, false to extinguish any fire on him

Returns

Returns true if successful, false otherwise

Example

This script will set player on fire when they fall into water.

Click to collapse [-]
Client
addEventHandler("onClientResourceStart", getRootElement(),
    function ()
        setTimer(   function()
                        if isElementInWater(getLocalPlayer()) then
                        setPedOnFire ( getLocalPlayer(), true )
                        end
                    end, 1000, 0)
    end
    )    

See Also