The Teams namespace contains a set of class functions for dealing with teams and team settings.
|Class Function Name||Return Type||Description||Tags|
||Returns true if teams are considered enemies under the current TeamMode. If either team is TEAM_NEUTRAL=0, returns false.||None|
||Returns true if teams are considered friendly under the current TeamMode. If either team is TEAM_NEUTRAL=0, returns true.||None|
In this example, a loop is done over 5 teams to see which are friendly, and which are enemies. Both functions can be used in a client script and server script.
Team 0 is always considered neutral.
-- Client script local localPlayer = Game.GetLocalPlayer() local playerTeam = localPlayer.team for i = 0, 4 do if Teams.AreTeamsEnemies(playerTeam, i) then print("You are enemies with team: " .. tostring(i)) elseif Teams.AreTeamsFriendly(playerTeam, i) then print("You are friendly with team: " .. tostring(i)) end end
See also: Game.GetLocalPlayer | Player.team | CoreLua.print
Last update: November 19, 2021