IsPlayerDucked: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
m (Visual improvement)
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
==Description==
{{Server client function}}
This function returns a boolean value (true or false) depending on whether the specified [[player]] is ducked (crouched) or not.
{{Deprecated|isPedDucked}}
 
This function checks if the specified [[player]] is ducked (crouched) or not.


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">bool IsPlayerDucked ( player player )</syntaxhighlight>
<syntaxhighlight lang="lua">bool isPlayerDucked ( player thePlayer )</syntaxhighlight>


===Required Arguments===
===Required Arguments===
*'''player''': A [[player]] object referencing the specified player
*'''thePlayer''': A [[player]] object referencing the specified player
 
===Returns===
Returns ''true'' if the player is ducked, ''false'' otherwise.


==Example==
==Example==
<syntaxhighlight lang="lua">player = getPlayerFromID ( 1 )
This example checks if a random player is ducked or not, and if so displays a message in the chat box.
if ( IsPlayerDucked ( player ) )
<syntaxhighlight lang="lua">
  outputChatBox ( GetPlayerName ( player ) , " is currently crouching." )
aPlayer = getRandomPlayer ( )
end</syntaxhighlight>
if ( isPlayerDucked ( aPlayer ) ) then
outputChatBox ( getClientName ( aPlayer ) .. " is currently crouching." )
end
</syntaxhighlight>


==See Also==
==See Also==
{{Player functions}}
{{Player functions}}

Latest revision as of 11:46, 26 June 2014

Emblem-important.png This function is deprecated. This means that its use is discouraged and that it might not exist in future versions.

Please use isPedDucked instead.


This function checks if the specified player is ducked (crouched) or not.

Syntax

bool isPlayerDucked ( player thePlayer )

Required Arguments

  • thePlayer: A player object referencing the specified player

Returns

Returns true if the player is ducked, false otherwise.

Example

This example checks if a random player is ducked or not, and if so displays a message in the chat box.

aPlayer = getRandomPlayer ( )
if ( isPlayerDucked ( aPlayer ) ) then
	outputChatBox ( getClientName ( aPlayer ) .. " is currently crouching." )
end

See Also