IsPedChoking: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 13: Line 13:


==Example==
==Example==
<section class="client" name="Client" show="true">
<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">

Revision as of 19:33, 13 February 2010

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

Click to collapse [-]
Server&Client

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