SetRadarAreaFlashing: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
 
(7 intermediate revisions by 6 users not shown)
Line 1: Line 1:
[[Category:Incomplete]]
__NOTOC__
 
{{Server client function}}
__NOTOC__
This function makes an existing radar area flash in transparency.
This fake function is for use with blah & blah and does blahblahblabhalbhl


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool setRadarAreaFlashing ( element radararea, bool flash )            
bool setRadarAreaFlashing ( radararea theRadarArea, bool flash )
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP||[[radararea]]:setFlashing|flashing|isRadarAreaFlashing}}


===Required Arguments===  
===Required Arguments===  
*'''argumentName:''' description
*'''theRadarArea:''' the [[radararea]] element we want to change flashing state of.
 
*'''flash:''' a bool indicating whether the radar area should flash (''true'' to flash, ''false'' to not flash).
===Optional Arguments===
{{OptionalArg}}
*'''argumentName2:''' descriptiona
*'''argumentName3:''' description


===Returns===
===Returns===
Returns ''true'' if blah, ''false'' otherwise.
Returns ''true'' if the new flash state was successfully set, ''false'' if the radar area doesn't exist or invalid arguments were passed.


==Example==  
==Example==  
This example does...
'''Example 1:''' This example checks to see whether an existing radar area (''someArea'') is flashing, and forces it to flash if it isn't:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
local isFlashing = isRadarAreaFlashing ( someArea )
blabhalbalhb --abababa
if isFlashing then                                          -- if the area is already flashing...
--This line does this...
    outputChatBox ( "The radar area is already flashing." )
mooo
else                                                        -- if it isn't...
    setRadarAreaFlashing ( someArea, true )                  -- make the area flash
end
</syntaxhighlight>
 
'''Example 2:''' This example creates a radar area for the ''King of the Hill'' script, and a colsquare. When the player enters the radar area flashes, it stops flashing when a player leaves.
<syntaxhighlight lang="lua">
-- create our hill area for our gamemode
local hillArea = createColSquare ( -2171.0678710938, 678.17950439453, 0, 15, 15 )
local hillRadar = createRadarArea ( -2183.5678710938, 705.67950439453, 40, -40, 0, 255, 0, 175 )
 
-- add hill_Enter as a handler for when a player enters the hill area
function hill_Enter ( thePlayer, matchingDimension )
    -- announce to everyone that the player entered the hill
    outputChatBox( getPlayerName(thePlayer) .. " entered the zone!", root, 255, 255, 109 )
    setRadarAreaFlashing ( hillRadar, true )
end
addEventHandler ( "onColShapeHit", hillArea, hill_Enter )
 
-- add hill_Enter as a handler for when a player leaves the hill area
function hill_Exit ( thePlayer, matchingDimension )
    -- check if the player is not dead
    if isPlayerDead ( thePlayer ) ~= true then
        -- if he was alive, announce to everyone that the player has left the hill
        outputChatBox ( getPlayerName(thePlayer) .. " left the zone!", root, 255, 255, 109 )
        setRadarAreaFlashing ( hillRadar, false )
    end
end
addEventHandler ( "onColShapeLeave", hillArea, hill_Exit )
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{FunctionArea_Functions}}
{{Radar area_functions}}

Latest revision as of 08:58, 4 November 2020

This function makes an existing radar area flash in transparency.

Syntax

bool setRadarAreaFlashing ( radararea theRadarArea, bool flash )

OOP Syntax Help! I don't understand this!

Method: radararea:setFlashing(...)
Variable: .flashing
Counterpart: isRadarAreaFlashing


Required Arguments

  • theRadarArea: the radararea element we want to change flashing state of.
  • flash: a bool indicating whether the radar area should flash (true to flash, false to not flash).

Returns

Returns true if the new flash state was successfully set, false if the radar area doesn't exist or invalid arguments were passed.

Example

Example 1: This example checks to see whether an existing radar area (someArea) is flashing, and forces it to flash if it isn't:

local isFlashing = isRadarAreaFlashing ( someArea )
if isFlashing then                                           -- if the area is already flashing...
    outputChatBox ( "The radar area is already flashing." )
else                                                         -- if it isn't...
    setRadarAreaFlashing ( someArea, true )                  -- make the area flash
end

Example 2: This example creates a radar area for the King of the Hill script, and a colsquare. When the player enters the radar area flashes, it stops flashing when a player leaves.

-- create our hill area for our gamemode
local hillArea = createColSquare ( -2171.0678710938, 678.17950439453, 0, 15, 15 )
local hillRadar = createRadarArea ( -2183.5678710938, 705.67950439453, 40, -40, 0, 255, 0, 175 )

-- add hill_Enter as a handler for when a player enters the hill area
function hill_Enter ( thePlayer, matchingDimension )
    -- announce to everyone that the player entered the hill
    outputChatBox( getPlayerName(thePlayer) .. " entered the zone!", root, 255, 255, 109 )
    setRadarAreaFlashing ( hillRadar, true )
end
addEventHandler ( "onColShapeHit", hillArea, hill_Enter )

-- add hill_Enter as a handler for when a player leaves the hill area
function hill_Exit ( thePlayer, matchingDimension )
    -- check if the player is not dead
    if isPlayerDead ( thePlayer ) ~= true then
        -- if he was alive, announce to everyone that the player has left the hill
        outputChatBox ( getPlayerName(thePlayer) .. " left the zone!", root, 255, 255, 109 )
        setRadarAreaFlashing ( hillRadar, false )
    end
end
addEventHandler ( "onColShapeLeave", hillArea, hill_Exit )

See Also