GetPlayersInTeam: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
Line 20: Line 20:
   players = getPlayersInTeam ( redTeam )   
   players = getPlayersInTeam ( redTeam )   
   -- Loop through the player table
   -- Loop through the player table
   for playerKey, playerValue in players do
   for playerKey, playerValue in ipairs(players) do
     -- kill the player
     -- kill the player
     killPlayer ( playerValue )
     killPlayer ( playerValue )

Revision as of 22:30, 6 May 2007

This function is for retrieving all the players in the specified team.

Syntax

table getPlayersInTeam ( team theTeam )

Optional Arguments

  • theTeam: The team you wish to retrieve all the players from.

Returns

Returns a table of all the players in the team.

Example

-- Find and kill all the players in a team called "red"
redTeam = getTeamFromName ( "red" )
if ( redTeam ) then
  players = getPlayersInTeam ( redTeam )  
  -- Loop through the player table
  for playerKey, playerValue in ipairs(players) do
    -- kill the player
     killPlayer ( playerValue )
  end
end

See Also

Shared