GetTeamName: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 1: | Line 1: | ||
{{Server client function}} | |||
__NOTOC__ | __NOTOC__ | ||
This function | This function gets the team name of a team object. | ||
==Syntax== | ==Syntax== | ||
Line 11: | Line 12: | ||
===Returns=== | ===Returns=== | ||
Returns a string representing the | Returns a string representing the team's name if the team object was valid, ''false'' otherwise. | ||
==Example== | ==Example== | ||
Line 17: | Line 18: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function whatTeamAmIOn ( source ) | function whatTeamAmIOn ( source ) | ||
-- Get the player's team (source is the player who entered the command) | |||
team = getPlayerTeam ( source ) | |||
if ( team ) then -- if he was on a team | |||
outputChatBox ( getClientName ( source ) .. " is on team: " .. getTeamName ( team ) ) | |||
else | |||
outputChatBox ( getClientName ( source ) .. " isn't on a team" ) | |||
end | |||
end | end | ||
Revision as of 18:59, 17 August 2007
This function gets the team name of a team object.
Syntax
string getTeamName ( team theTeam )
Required Arguments
- theTeam: The team you want to retrieve the name of.
Returns
Returns a string representing the team's name if the team object was valid, false otherwise.
Example
This example gets the current team of a player, then prints its name to the chatbox.
function whatTeamAmIOn ( source ) -- Get the player's team (source is the player who entered the command) team = getPlayerTeam ( source ) if ( team ) then -- if he was on a team outputChatBox ( getClientName ( source ) .. " is on team: " .. getTeamName ( team ) ) else outputChatBox ( getClientName ( source ) .. " isn't on a team" ) end end -- Add console command to find your team when 'whatTeamAmIOn' is typed. addCommandHandler ( "whatTeamAmIOn", whatTeamAmIOn )
See Also
- countPlayersInTeam
- getPlayerTeam
- getPlayersInTeam
- getTeamColor
- getTeamFriendlyFire
- getTeamFromName
- getTeamName