|
|
| Line 2: |
Line 2: |
| enjoy | | enjoy |
| [[User:Drline|Drline]] 04:44, 30 October 2012 (UTC) | | [[User:Drline|Drline]] 04:44, 30 October 2012 (UTC) |
|
| |
| == countPlayersInWater ==
| |
|
| |
| This function is for returning the number of players in the water.
| |
| ==Syntax==
| |
| <syntaxhighlight lang="lua">int countPlayersInWater( )</syntaxhighlight>
| |
|
| |
| ===Returns===
| |
| Returns an integer containing the number of players in the water.
| |
|
| |
| ==Code==
| |
| <syntaxhighlight lang="lua">
| |
| function countPlayersInWater( )
| |
| local count = 0
| |
| for i,player in ipairs(getElementsByType("player")) do
| |
| if isElementInWater(player) then
| |
| count = count + 1
| |
| end
| |
| end
| |
| return count
| |
| end
| |
| </syntaxhighlight>
| |
|
| |
| ==Example==
| |
| <section name="Example" class="both" show="true">
| |
| This example adds a command in the console to find out how many players are on your team, clientside
| |
| <syntaxhighlight lang="lua">
| |
| outputChatBox("Number of Players in Water : ".. countPlayersInWater( ))
| |
| </syntaxhighlight>
| |
| </section>
| |
|
| |
| ==See Also==
| |
| {{Useful_Functions}}
| |
Revision as of 15:12, 5 February 2015
there i wrote isElementInPhotograph()
enjoy
Drline 04:44, 30 October 2012 (UTC)