CountPlayersInTeam

From Multi Theft Auto: Wiki
Revision as of 17:43, 11 January 2007 by Jbeta (talk | contribs)
Jump to navigation Jump to search

This function is for returning the number of players in the specified team.

Syntax

int countPlayersInTeam ( team theTeam )

Optional Arguments

  • theTeam: The team you wish to retrieve the player count of.

Returns

Returns an integer containing the number of players in the team.

Example

addCommandHandler ( "teamsize", "outputTeamSize" )
function outputTeamSize ( player )
	-- Get player's team
	local team = getPlayerTeam ( player )
	-- If the player is in any team
	if team then
		-- Tell the player how big his team is
		outputChatBox ( "Your team has " .. countPlayersInTeam ( team ) .. " players.", player )
	else
		outputChatBox ( "You're not in a team.", player )
	end
end

See Also