SetTeamName: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (→See Also) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 7: | Line 7: | ||
bool setTeamName ( team theTeam, string newName ) | bool setTeamName ( team theTeam, string newName ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[team]]:setName|name|getTeamName}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theTeam:''' The team you want to change the name of. | *'''theTeam:''' The [[team]] you want to change the name of. | ||
*'''newName:''' A string representing the name you want the team to be called. | *'''newName:''' A string representing the name you want the team to be called. | ||
Line 23: | Line 23: | ||
oldName = getTeamName ( playerteam ) -- get the teams current name | oldName = getTeamName ( playerteam ) -- get the teams current name | ||
setTeamName ( playerteam, newName ) -- change the teams name to blue | setTeamName ( playerteam, newName ) -- change the teams name to blue | ||
outputChatBox ( "Changed " .. | outputChatBox ( "Changed " .. getPlayerName ( source ) .. "'s team name from " .. oldName .. " to " .. newName ) | ||
end | end | ||
end | end | ||
Line 30: | Line 30: | ||
==See Also== | ==See Also== | ||
{{Team_functions}} | {{Team_functions|server}} |
Latest revision as of 23:02, 6 September 2024
This function is used to set a team's name.
Syntax
bool setTeamName ( team theTeam, string newName )
OOP Syntax Help! I don't understand this!
- Method: team:setName(...)
- Variable: .name
- Counterpart: getTeamName
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
Returns true if the team was valid and the name was changed, false otherwise.
Example
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 )
See Also
- createTeam
- setPlayerTeam
- setTeamColor
- setTeamFriendlyFire
- setTeamName
- Shared
- countPlayersInTeam
- getPlayerTeam
- getPlayersInTeam
- getTeamColor
- getTeamFriendlyFire
- getTeamFromName
- getTeamName