GetTeamFriendlyFire: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 8: | Line 8: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theTeam:''' The team that will be checked | *'''theTeam:''' The team object that will be checked | ||
===Returns=== | ===Returns=== | ||
Line 14: | Line 14: | ||
==Example== | ==Example== | ||
This example checks if friendly fire is on for | This example makes a command that checks if friendly fire is on for each team, and toggles it on if it isn't. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | function setFriendlyFireOn ( ) | ||
for index, theTeam in ipairs(getElementsByType ( "team" )) do | -- 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 | |||
end | end | ||
end | end | ||
-- Add console command 'setFF' | |||
addCommandHandler ( "setFF", setFriendlyFireOn ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Team functions}} | {{Team functions}} |
Revision as of 06:39, 4 August 2007
This function returns the friendly fire value for the specified team.
Syntax
bool getTeamFriendlyFire ( team theTeam )
Required Arguments
- theTeam: The team object that will be checked
Returns
Returns true if friendly fire is on for the specified team, false if friendly fire is turned off for the specified team or if invalid arguments are specified.
Example
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 end end -- Add console command 'setFF' addCommandHandler ( "setFF", setFriendlyFireOn )
See Also
- countPlayersInTeam
- getPlayerTeam
- getPlayersInTeam
- getTeamColor
- getTeamFriendlyFire
- getTeamFromName
- getTeamName