countPlayersInTeam | Multi Theft Auto: Wiki Skip to content

countPlayersInTeam

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


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

Syntax

countPlayersInTeam ( )

Code Examples

server

This example adds a command in the console to find out how many players are on your team.

function outputTeamSize ( source, commandName )
-- Get player's team
local theTeam = getPlayerTeam ( source )
-- If the player is in any team
if theTeam 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