SetPedChoking: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
m (→See Also) |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server function}} | {{Server function}} | ||
This function can be used to force the ped to do the choking | This function can be used to force the ped to do the choking (coughing) animation until he respawns or toggled off using this function. The animation can not be cancelled by a player it's applied to, and he will not loose health. | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool setPedChoking ( ped thePed, bool choking ) | bool setPedChoking ( ped thePed, bool choking ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[ped]]:setChoking|choking|isPedChoking}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
Line 19: | Line 20: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- Choke all the players when the resource starts | -- Choke all the players when the resource starts | ||
function | |||
setPedChoking ( root, true ) | function onResourceStart() | ||
setPedChoking(root, true) | |||
end | end | ||
addEventHandler ( "onResourceStart", | addEventHandler("onResourceStart", resourceRoot, onResourceStart) | ||
-- Unchoke all the players when the resource stops | -- Unchoke all the players when the resource stops | ||
function | |||
setPedChoking ( root, false ) | function onResourceStop() | ||
setPedChoking(root, false) | |||
end | end | ||
addEventHandler ( "onResourceStop", | addEventHandler("onResourceStop", resourceRoot, onResourceStop) | ||
-- Choke players spawning | -- Choke players spawning | ||
function | |||
setPedChoking ( source, true ) | function onPlayerSpawn() | ||
setPedChoking(source, true) | |||
end | end | ||
addEventHandler ( "onPlayerSpawn", root, | addEventHandler("onPlayerSpawn", root, onPlayerSpawn) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Ped functions}} | {{Ped functions|server}} | ||
[[ru:setPedChoking]] | [[ru:setPedChoking]] |
Latest revision as of 22:36, 6 September 2024
This function can be used to force the ped to do the choking (coughing) animation until he respawns or toggled off using this function. The animation can not be cancelled by a player it's applied to, and he will not loose health.
Syntax
bool setPedChoking ( ped thePed, bool choking )
OOP Syntax Help! I don't understand this!
- Method: ped:setChoking(...)
- Variable: .choking
- Counterpart: isPedChoking
Required Arguments
- thePed: The ped whose choking status to toggle
- choking: true to make the ped choke, false to no longer force his choking animation
Returns
Returns true if successful, false otherwise (e.g. player handle is invalid)
Example
This script will make all players choke on resource start
-- Choke all the players when the resource starts function onResourceStart() setPedChoking(root, true) end addEventHandler("onResourceStart", resourceRoot, onResourceStart) -- Unchoke all the players when the resource stops function onResourceStop() setPedChoking(root, false) end addEventHandler("onResourceStop", resourceRoot, onResourceStop) -- Choke players spawning function onPlayerSpawn() setPedChoking(source, true) end addEventHandler("onPlayerSpawn", root, onPlayerSpawn)
See Also
- getPedGravity
- reloadPedWeapon
- setPedChoking
- setPedGravity
- setPedWearingJetpack
- Shared
- 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