IsPedChoking: Difference between revisions

From Multi Theft Auto: Wiki
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...)
 
No edit summary
Line 15: Line 15:
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">
aPlayer = getRandomPlayer ( )
local players = getElementsByType("player")
if ( isPedChoking ( aPlayer ) ) then
local randomPlayer = players[math.random(#players)]
outputChatBox ( getPlayerName ( aPlayer ) .. " is choking.  Keep away from those cigarettes!" )
if ( isPedChoking ( randomPlayer ) ) then
outputChatBox ( getPlayerName ( randomPlayer ) .. " is choking.  Keep away from those cigarettes!" )
end
end
</syntaxhighlight>
</syntaxhighlight>

Revision as of 18:05, 30 March 2008

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 )

Required Arguments

  • thePed: The ped you wish to check

Returns

Returns true if the ped is choking, false otherwise.

Example

This 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