getTeamName | Multi Theft Auto: Wiki Skip to content

getTeamName

Client-side
Server-side
Shared

Pair: setTeamName

This page is incomplete! Help wanted!

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


This function gets the team name of a team object.

Syntax

getTeamName ( )

Code Examples

server

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)
local playerTeam = getPlayerTeam(source)
if (playerTeam) then -- if he was on a team
outputChatBox(getPlayerName(source).." is on team: "..getTeamName(playerTeam))
else
outputChatBox(getPlayerName(source).. " isn't on a team")
end
end
-- Add console command to find your team when 'whatTeamAmIOn' is typed.
addCommandHandler("whatTeamAmIOn", whatTeamAmIOn)