GetPlayerTeam: Difference between revisions
Jump to navigation
Jump to search
(OOP syntax added) |
(→Syntax) |
||
Line 5: | Line 5: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
team getPlayerTeam ( player | team getPlayerTeam ( player ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[player]]:getTeam|team|setPlayerTeam}} | {{OOP||[[player]]:getTeam|team|setPlayerTeam}} |
Revision as of 21:10, 23 July 2018
This function gets the current team a player is on.
Syntax
team getPlayerTeam ( player )
OOP Syntax Help! I don't understand this!
- Method: player:getTeam(...)
- Variable: .team
- Counterpart: setPlayerTeam
Required Arguments
- thePlayer: The player whose team you want to find out.
Returns
Returns a team element representing the team the player is on, false if the player is not part of a team.
Example
Click to collapse [-]
ServerThis 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
- getPlayerTeam
- getPlayerBlurLevel
- setPlayerBlurLevel
- getPlayerSerial
- forcePlayerMap
- getPlayerScriptDebugLevel
- getPlayerFromName
- getPlayerMoney
- getPlayerName
- getPlayerNametagColor
- getPlayerNametagText
- getPlayerPing
- getPlayerWantedLevel
- givePlayerMoney
- isPlayerMapForced
- isPlayerNametagShowing
- setPlayerHudComponentVisible
- setPlayerMoney
- setPlayerNametagColor
- setPlayerNametagShowing
- setPlayerNametagText
- takePlayerMoney
- countPlayersInTeam
- getPlayersInTeam
- isVoiceEnabled
- setControlState
- getControlState