setTeamName | Multi Theft Auto: Wiki Skip to content

setTeamName

Client-side
Server-side
Shared

Pair: getTeamName

Manual Review Required

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


This function is used to set a team's name.

OOP Syntax Help! I don't understand this!

  • Method: team:setName(...)
  • Variable: .name

Syntax

bool setTeamName ( team theTeam, string newName )
Required Arguments
  • theTeam: The team you want to change the name of.
  • newName: A string representing the name you want the team to be called.

Returns

  • bool: value

Returns true if the team was valid and the name was changed, false otherwise.

Code Examples

shared

This example gets the current team of a player, then changes its name.

function changeMyTeamName ( source, key, newName )
playerteam = getPlayerTeam ( source ) -- get the player's team
if ( playerteam ) then -- if he was on a team
oldName = getTeamName ( playerteam ) -- get the teams current name
setTeamName ( playerteam, newName ) -- change the teams name to blue
outputChatBox ( "Changed " .. getPlayerName ( source ) .. "'s team name from " .. oldName .. " to " .. newName )
end
end
addCommandHandler ( "changeteamname", changeMyTeamName )