IsPlayerInWater: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(Removed Template:Needs Checking: Tested, verified note (clientside version syntax lacked player arg). Added section for example) |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | {{Server client function}} | ||
Line 6: | Line 4: | ||
==Syntax== | ==Syntax== | ||
<section name="Server" class=" | <section name="Server and client" class="both" show="true"> | ||
<syntaxhighlight lang="lua">bool isPlayerInWater ( player thePlayer )</syntaxhighlight> | <syntaxhighlight lang="lua">bool isPlayerInWater ( player thePlayer )</syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''thePlayer:''' The [[player]] you are checking. | *'''thePlayer:''' The [[player]] you are checking. | ||
===Returns=== | ===Returns=== | ||
Line 24: | Line 15: | ||
==Example== | ==Example== | ||
<section name="Serverside example" class="server" show="true"> | |||
This example shows all players that are in water in a list to the player who enters the 'playersInWater' command. | This example shows all players that are in water in a list to the player who enters the 'playersInWater' command. | ||
<syntaxhighlight lang="lua"> [lua] | <syntaxhighlight lang="lua"> [lua] | ||
Line 38: | Line 30: | ||
addCommandHandler("playersInWater", showPlayersInWater) | addCommandHandler("playersInWater", showPlayersInWater) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
==See Also== | ==See Also== | ||
{{Player functions}} | {{Player functions}} |
Revision as of 14:47, 19 September 2007
This function is used to determine whether or not a player is currenlty in water.
Syntax
Click to collapse [-]
Server and clientbool isPlayerInWater ( player thePlayer )
Required Arguments
- thePlayer: The player you are checking.
Returns
Returns true if the player is in water, false otherwise.
Example
Click to collapse [-]
Serverside exampleThis example shows all players that are in water in a list to the player who enters the 'playersInWater' command.
[lua] function showPlayersInWater(sourcePlayer, command) local players = getElementsByType("player") local list = "" for k,v in ipairs(players) do if isPlayerInWater(v) then list = list .. " " .. getClientName(v) end end outputChatBox("Players pretending to be trouts: " .. list, sourcePlayer) end addCommandHandler("playersInWater", showPlayersInWater)
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