<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Michaeljonesbous</id>
	<title>Multi Theft Auto: Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Michaeljonesbous"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Michaeljonesbous"/>
	<updated>2026-04-12T17:30:16Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=CreateTeam&amp;diff=55330</id>
		<title>CreateTeam</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CreateTeam&amp;diff=55330"/>
		<updated>2018-06-16T01:21:29Z</updated>

		<summary type="html">&lt;p&gt;Michaeljonesbous: /* Syntax */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server function}}&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
team createTeam ( string WTF, [int colorR = 255, int colorG = 255, int colorB = 255] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||Team.create||}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''TheFuk:''' A string representing the teams name.&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
*'''colorR:''' An integer representing the red color value.&lt;br /&gt;
*'''colorG:''' An integer representing the green color value.&lt;br /&gt;
*'''colorB:''' An integer representing the blue color value.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a team element if it was successfully created, ''false'' if invalid arguments are passed or a team with that name already exists.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
'''Example 1:''' This example creates a new team for a player, then adds him to it.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function gimmeATeam ( source, commandName, teamName )&lt;br /&gt;
  local newTeam = createTeam ( teamName ) -- create a new team with the specified name&lt;br /&gt;
  if newTeam then -- if it was successfully created&lt;br /&gt;
    setPlayerTeam ( source, newTeam ) -- add the player to the new team&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;giveteam&amp;quot;, gimmeATeam)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 2:''' This example creates two teams, one for Admin and one for Freeroamers, when the resource this script is in is started.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createTeamsOnStart ()&lt;br /&gt;
	teamAdmmin = createTeam ( &amp;quot;Admin&amp;quot;, 0, 255, 0 ) --change the 3 numbers(0,255,0), the first number is ColourR, the second is ColourG, and the last one is ColourB&lt;br /&gt;
	teamFreeroamers = createTeam ( &amp;quot;Freeroamer&amp;quot;, 200, 0, 100 )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onResourceStart&amp;quot;, resourceRoot, createTeamsOnStart) --we attach the function to this resource's root element&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 3:''' This example creates a team for Admin and when an admin logs in, he will be set in the Admin team.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createAdminTeamOnStart ()&lt;br /&gt;
	AdminTeam = createTeam ( &amp;quot;Admin&amp;quot;, 0, 255, 0 )-- create a new team and name it 'Admin'&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onResourceStart&amp;quot;, resourceRoot, createAdminTeamOnStart) -- add an event handler&lt;br /&gt;
&lt;br /&gt;
function setAdminTeam()&lt;br /&gt;
if isObjectInACLGroup(&amp;quot;user.&amp;quot;..getAccountName(getPlayerAccount(source)), aclGetGroup(&amp;quot;Admin&amp;quot;)) then -- if he is admin&lt;br /&gt;
   setPlayerTeam(source, AdminTeam) -- set him to admin team&lt;br /&gt;
   end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerLogin&amp;quot;,getRootElement(),setAdminTeam) -- add an event handler&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Team_functions}}&lt;/div&gt;</summary>
		<author><name>Michaeljonesbous</name></author>
	</entry>
</feed>