CountPlayersInTeam

From Multi Theft Auto: Wiki
Revision as of 19:12, 15 July 2007 by Talidan (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

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

See Also

Shared