IsPlayerInWater: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Removed Template:Needs Checking: Tested, verified note (clientside version syntax lacked player arg). Added section for example)
(watch the spelling pal)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server client function}}
{{Server client function}}
This function is used to determine whether or not a player is currenlty in water.
This function is used to determine whether or not a player is currently in water.


==Syntax==
==Syntax==

Revision as of 18:51, 20 September 2007

This function is used to determine whether or not a player is currently in water.

Syntax

Click to collapse [-]
Server and client
bool 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 example

This 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