SetPedOnFire: Difference between revisions
Jump to navigation
Jump to search
(New page: __NOTOC__ {{Server function}} This function can be used to set a ped on fire or extinguish a fire on it. ==Syntax== <syntaxhighlight lang="lua"> bool setPedOnFire ( ped thePed, bool isOnFire ) </syntaxhighlight> ...) |
(Improve example.) |
||
(6 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server function}} | {{Server client function}} | ||
This function can be used to set a ped on fire or extinguish a fire on it. | This function can be used to set a ped on fire or extinguish a fire on it. | ||
Line 7: | Line 7: | ||
bool setPedOnFire ( ped thePed, bool isOnFire ) | bool setPedOnFire ( ped thePed, bool isOnFire ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[ped]]:setOnFire|onFire|isPedOnFire}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
Line 16: | Line 17: | ||
==Example== | ==Example== | ||
This script will | 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"> | ||
function setLocalPlayerOnFire() | |||
</syntaxhighlight> | 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) | |||
</syntaxhighlight></section> | |||
==See Also== | ==See Also== | ||
{{Ped functions}} | {{Ped functions}} | ||
[[ru:setPedOnFire]] |
Latest revision as of 05:37, 26 August 2021
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 [-]
Clientfunction 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
- addPedClothes
- getPedClothes
- removePedClothes
- createPed
- getPedAmmoInClip
- getPedArmor
- getPedFightingStyle
- getPedOccupiedVehicle
- getPedOccupiedVehicleSeat
- getPedStat
- getPedTarget
- getPedTotalAmmo
- getPedWalkingStyle
- getPedWeapon
- getPedWeaponSlot
- getPedContactElement
- getValidPedModels
- isPedChoking
- isPedDead
- isPedDoingGangDriveby
- isPedDucked
- isPedHeadless
- isPedInVehicle
- isPedOnFire
- isPedOnGround
- isPedWearingJetpack
- killPed
- removePedFromVehicle
- setPedAnimation
- setPedAnimationProgress
- setPedAnimationSpeed
- setPedArmor
- setPedDoingGangDriveby
- setPedFightingStyle
- setPedHeadless
- setPedOnFire
- setPedStat
- setPedWalkingStyle
- setPedWeaponSlot
- warpPedIntoVehicle