Difference between revisions of "GetTeamName"

From Multi Theft Auto: Wiki
(OOP syntax added)
m (Reverted edits by Al7arthy (talk) to last revision by MarioKart)
(7 intermediate revisions by one other user not shown)
(No difference)

Latest revision as of 14:44, 13 July 2019

This function gets the team name of a team object.


string getTeamName ( team theTeam )

OOP Syntax Help! I don't understand this!

Method: team:getName(...)
Variable: .name
Counterpart: setTeamName

Required Arguments

  • theTeam: The team you want to retrieve the name of.


Returns a string representing the team's name if the team object was valid, false otherwise.


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))
        outputChatBox(getPlayerName(source).. " isn't on a team")

-- Add console command to find your team when 'whatTeamAmIOn' is typed.
addCommandHandler("whatTeamAmIOn", whatTeamAmIOn)

See Also