getPlayersInTeam | Multi Theft Auto: Wiki Skip to content

getPlayersInTeam

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 retrieves all the players of the specified team.

Syntax

getPlayersInTeam ( )

Code Examples

server

Find and kill all the players in the specified team (for example 'killTeam Red').

function killTeamFunction ( thePlayer, command, teamName )
-- Find and kill all the players in the team that was specified with the console command
local theTeam = getTeamFromName ( teamName )
if ( theTeam ) then
local players = getPlayersInTeam ( theTeam )
-- Loop through the player table
for playerKey, playerValue in ipairs ( players ) do
-- kill the player
killPlayer ( playerValue )
end
end
end
addCommandHandler ( "killTeam", killTeamFunction )

See Also