getTeamFriendlyFire
Client-side
Server-side
Shared
Pair: setTeamFriendlyFire
Manual Review Required
Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.
This function tells you if friendly fire is turned on for the specified team.
OOP Syntax Help! I don't understand this!
- Method: team:getFriendlyFire(...)
- Variable: .friendlyFire
Syntax
bool getTeamFriendlyFire ( team theTeam )Required Arguments
- theTeam: The team object that will be checked
Returns
- bool: value
Returns true if friendly fire is on for the specified team, false if it is turned off or if invalid arguments are specified.
Code Examples
shared
This example makes a command that checks if friendly fire is on for each team, and toggles it on if it isn't.
function setFriendlyFireOn ( ) -- For each team, for index, theTeam in ipairs ( getElementsByType("team") ) do -- if friendly fire is off, if ( getTeamFriendlyFire ( theTeam ) == false ) then -- switch it on. setTeamFriendlyFire ( theTeam, true ) end endend-- Add console command 'setFF'addCommandHandler ( "setFF", setFriendlyFireOn )