IsPedChoking: Difference between revisions
Jump to navigation
Jump to search
(New page: __NOTOC__ {{Client function}} This function checks if the specified ped is choking (coughing) or not. This happens as a result of weapons that produce smoke - smoke grenades, fire exti...) |
(Added OOP syntax) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{ | {{Server client function}} | ||
This function checks if the specified [[ped]] is choking (coughing) or not. This happens as a result of weapons that produce smoke - smoke grenades, fire extinguisher and the spray can. | This function checks if the specified [[ped]] is choking (coughing) or not. This happens as a result of weapons that produce smoke - smoke grenades, fire extinguisher and the spray can. | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">bool isPedChoking ( ped thePed )</syntaxhighlight> | <syntaxhighlight lang="lua">bool isPedChoking ( ped thePed )</syntaxhighlight> | ||
{{OOP||[[ped]]:isChoking|choking|setPedChoking}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
Line 13: | Line 14: | ||
==Example== | ==Example== | ||
<section class="both" name="Server&Client" show="true"> | |||
This example checks if a random player is choking or not, and if so displays a message in the chat box. | This example checks if a random player is choking or not, and if so displays a message in the chat box. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
local players = getElementsByType ( "player" ) | |||
if | local randomPlayer = players[math.random(#players)] | ||
outputChatBox ( getPlayerName ( | if isPedChoking ( randomPlayer ) then | ||
outputChatBox ( getPlayerName ( randomPlayer ) .. " is choking. Keep away from those cigarettes!" ) | |||
end | end | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
==See Also== | ==See Also== | ||
{{ | {{Ped functions}} |
Latest revision as of 17:25, 26 November 2014
This function checks if the specified ped is choking (coughing) or not. This happens as a result of weapons that produce smoke - smoke grenades, fire extinguisher and the spray can.
Syntax
bool isPedChoking ( ped thePed )
OOP Syntax Help! I don't understand this!
- Method: ped:isChoking(...)
- Variable: .choking
- Counterpart: setPedChoking
Required Arguments
- thePed: The ped you wish to check
Returns
Returns true if the ped is choking, false otherwise.
Example
Click to collapse [-]
Server&ClientThis example checks if a random player is choking or not, and if so displays a message in the chat box.
local players = getElementsByType ( "player" ) local randomPlayer = players[math.random(#players)] if isPedChoking ( randomPlayer ) then outputChatBox ( getPlayerName ( randomPlayer ) .. " is choking. Keep away from those cigarettes!" ) end
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