Garry's Mod Wiki

Revision Difference

Player:SetTeam#527159

<function name="SetTeam" parent="Player" type="classfunc"> <description>Sets the player to the chosen team.</description> <realm>Server</realm> <args> <arg name="Team" type="number">The team that the player is being set to.</arg> </args> </function> <example> <description>Sets the players team to the first argument when writing "set_team" into the console and respawns the player afterwards, ex. "set_team 1".</description> <code> function ChangeMyTeam( ply, cmd, args ) ply:SetTeam( args[1] )⤶ ply:Spawn() end⤶ concommand.Add( "set_team", ChangeMyTeam ) concommand.Add( "set_team", function( ply, cmd, args ) local Team = args[1] or 1⤶ ply:SetTeam( Team ) ply:Spawn()⤶ end ) </code> <output>Sets the player to team 1 and respawns him/her.</output> <output>Sets the player to team 1 and respawns them.</output> </example>