IsPlayerDead: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 13: | Line 13: | ||
==Example== | ==Example== | ||
This example | This example allows a player to use the command 'amidead' to see if they are dead or not. | ||
<section name="Server" class="server" show="true"> | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
player | --Check if player is alive or dead and let them know in the chat box | ||
if ( isPlayerDead ( player ) ) then | function deathCheck ( player, commandName ) | ||
-- This if statement is true if the player is dead | |||
if ( isPlayerDead ( player ) ) then | |||
outputChatBox ( "You're dead... prepare to become a zombie." ) | |||
else | |||
outputChatBox ( "Count your lucky stars, you're alive." ) | |||
end | |||
end | end | ||
addCommandHandler ( "amidead", deathCheck ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
==See Also== | ==See Also== | ||
{{Player functions}} | {{Player functions}} |
Revision as of 06:55, 11 October 2007
This function checks if the specified player is dead or not.
Syntax
bool isPlayerDead ( player thePlayer )
Required Arguments
- thePlayer: A player object referencing the specified player
Returns
Returns true if the player is dead, false otherwise.
Example
This example allows a player to use the command 'amidead' to see if they are dead or not.
Click to collapse [-]
Server--Check if player is alive or dead and let them know in the chat box function deathCheck ( player, commandName ) -- This if statement is true if the player is dead if ( isPlayerDead ( player ) ) then outputChatBox ( "You're dead... prepare to become a zombie." ) else outputChatBox ( "Count your lucky stars, you're alive." ) end end addCommandHandler ( "amidead", deathCheck )
See Also
- getPlayerTeam
- getPlayerBlurLevel
- setPlayerBlurLevel
- getPlayerSerial
- forcePlayerMap
- getPlayerScriptDebugLevel
- getPlayerFromName
- getPlayerMoney
- getPlayerName
- getPlayerNametagColor
- getPlayerNametagText
- getPlayerPing
- getPlayerWantedLevel
- givePlayerMoney
- isPlayerMapForced
- isPlayerNametagShowing
- setPlayerHudComponentVisible
- setPlayerMoney
- setPlayerNametagColor
- setPlayerNametagShowing
- setPlayerNametagText
- takePlayerMoney
- countPlayersInTeam
- getPlayersInTeam
- isVoiceEnabled
- setControlState
- getControlState