SetPedOnFire: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 20: Line 20:
<section name="Client" class="client" show="true">
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addEventHandler("onClientResourceStart", getRootElement(),
addEventHandler("onClientResourceStart", resourceRoot,
     function ()
     function ()
         setTimer(  function()
         setTimer(  function()
                         if isElementInWater(getLocalPlayer()) then
                         if isElementInWater(getLocalPlayer()) then
                        setPedOnFire ( getLocalPlayer(), true )
                            setPedOnFire ( getLocalPlayer(), true )
                         end
                         end
                     end, 1000, 0)
                     end, 1000, 0)

Revision as of 00:18, 18 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", resourceRoot,
    function ()
        setTimer(   function()
                        if isElementInWater(getLocalPlayer()) then
                            setPedOnFire ( getLocalPlayer(), true )
                        end
                    end, 1000, 0)
    end
    )    

See Also