getPlayerTeam | Multi Theft Auto: Wiki Skip to content

getPlayerTeam

Client-side
Server-side
Shared

Pair: setPlayerTeam

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 current team a player is on.

Syntax

getPlayerTeam ( )

Code Examples

server

This example finds the team a player is on, and then changes its name.

function teamName ( source, key, newTeamName )
local playerTeam = getPlayerTeam ( source ) -- get the player's team
if ( playerTeam ) then -- if he's on a team
local oldTeamName = getTeamName ( playerTeam ) -- get the team's current name
setTeamName ( playerTeam, newTeamName ) -- change its name
outputChatBox ( "Changed " .. getPlayerName ( source ).."'s team name from " .. oldTeamName .. " to " .. newTeamName )
else
outputChatBox ( getPlayerName ( source ) .. " isn't on a team" )
end
end
addCommandHandler ( "teamname", teamName )

See Also