SetPedOnFire

From Multi Theft Auto: Wiki
Revision as of 05:37, 26 August 2021 by Srslyyyy (talk | contribs) (Improve example.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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
function setLocalPlayerOnFire()
    local inWater = isElementInWater(localPlayer)

    if inWater then
        local notOnFire = not isPedOnFire(localPlayer)

        if notOnFire then
            setPedOnFire(localPlayer, true)
        end
    end
end
setTimer(setLocalPlayerOnFire, 1000, 0)

See Also