createTeam | Multi Theft Auto: Wiki Skip to content

createTeam

Client-side
Server-side
Shared

Manual Review Required

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


This function is for creating a new team, which can be used to group players. Players will not join the team until they are respawned.

OOP Syntax Help! I don't understand this!

  • Method: Team.create(...)

Syntax

team createTeam ( string teamName, [ int colorR = 235, int colorG = 221, int colorB = 178 ] )
Required Arguments
  • teamName: A string representing the teams name.
Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.

  • colorR (default: 235): An integer representing the red color value.
  • colorG (default: 221): An integer representing the green color value.
  • colorB (default: 178): An integer representing the blue color value.

Returns

  • team: value

Returns a team element if it was successfully created, false if invalid arguments are passed or a team with that name already exists.

Code Examples

shared

Example 1:This example creates a new team for a player, then adds him to it.

function gimmeATeam(source, commandName, teamName)
local newTeam = createTeam(teamName) -- create a new team with the specified name
if newTeam then -- if it was successfully created
setPlayerTeam(source, newTeam) -- add the player to the new team
end
end
addCommandHandler("giveteam", gimmeATeam)