setTeamFriendlyFire
Client-side
Server-side
Shared
Pair: getTeamFriendlyFire
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
This function sets the friendly fire value for the specified team.
OOP Syntax Help! I don't understand this!
- Method: team:setFriendlyFire(...)
- Variable: .friendlyFire
Syntax
bool setTeamFriendlyFire ( team theTeam, bool friendlyFire )Required Arguments
- theTeam: The team that will have friendly fire set
- friendlyFire: A boolean denoting whether the players from the same team can kill each other ( true ) or whether the players can't kill each other ( false ).
Returns
- bool: value
Returns true if the friendly fire value is set for the specified team, false if the friendly fire value can't be set for the specified team or if invalid arguments are specified.
Code Examples
shared
This example checks if friendly fire is on for every team, and toggles it on if it isn't.
-- get a table with all teamslocal allTeams = getElementsByType ( "team" )-- for every team,for index, theTeam in ipairs(allTeams) do -- if friendly fire is off, if ( getTeamFriendlyFire ( theTeam ) == false ) then -- switch it on setTeamFriendlyFire ( theTeam, true ) endend