GetPlayerTeam

From Multi Theft Auto: Wiki
Revision as of 14:52, 30 June 2006 by MrJax (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function is used to get the current team a player is on.

Syntax

team getPlayerTeam ( player thePlayer )

Required Arguments

  • thePlayer: The player whose team you want to find out.

Example

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

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

See Also