GetTeamFriendlyFire: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(OOP syntax added)
 
(5 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[[Category:Incomplete]]
{{Server client function}}
 
__NOTOC__
__NOTOC__  
This function tells you if friendly fire is turned on for the specified team.
This function returns the friendly fire value for the specified team.


==Syntax==  
==Syntax==  
Line 8: Line 7:
bool getTeamFriendlyFire ( team theTeam )
bool getTeamFriendlyFire ( team theTeam )
</syntaxhighlight>  
</syntaxhighlight>  
 
{{OOP||[[team]]:getFriendlyFire|friendlyFire|setTeamFriendlyFire}}
===Required Arguments===  
===Required Arguments===  
*'''theTeam:''' The client that will be checked
*'''theTeam:''' The team object that will be checked


===Returns===
===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.
Returns ''true'' if friendly fire is on for the specified team, ''false'' if it is turned off or if invalid arguments are specified.


==Example==  
==Example==  
This example does...
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">
--This line does...
function setFriendlyFireOn ( )
blabhalbalhb --abababa
-- For each team,
--This line does this...
for index, theTeam in ipairs ( getElementsByType("team") ) do
mooo
        -- 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 )
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{FunctionArea_Functions}}
{{Team functions}}

Latest revision as of 06:48, 12 July 2014

This function tells you if friendly fire is turned on for the specified team.

Syntax

bool getTeamFriendlyFire ( team theTeam )

OOP Syntax Help! I don't understand this!

Method: team:getFriendlyFire(...)
Variable: .friendlyFire
Counterpart: setTeamFriendlyFire


Required Arguments

  • theTeam: The team object that will be checked

Returns

Returns true if friendly fire is on for the specified team, false if it is turned off 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

Shared