CreateRadarArea: Difference between revisions
Jump to navigation
Jump to search
m (Fix oop instantiation) |
IMr.Wifi..! (talk | contribs) |
||
| Line 14: | Line 14: | ||
*'''sizeX:''' A float representing the width of the radar area. | *'''sizeX:''' A float representing the width of the radar area. | ||
*'''sizeY:''' A float representing the height of the radar area. | *'''sizeY:''' A float representing the height of the radar area. | ||
===Optional Arguments=== | ===Optional Arguments=== | ||
Revision as of 20:33, 31 May 2017
This function can be used to create custom radar areas on the radar.
Syntax
radararea createRadarArea ( float leftX, float bottomY, float sizeX, float sizeY, [ int r = 255, int g = 0, int b = 0, int a = 255, element visibleTo = getRootElement() ] )
OOP Syntax Help! I don't understand this!
- Method: RadarArea(...)
Required Arguments
- leftX: A float representing the left 'x' position of the radar area.
- bottomY: A float representing the bottom 'y' position of the radar area.
- sizeX: A float representing the width of the radar area.
- sizeY: A float representing the height of the radar area.
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.
- visibleTo: An element that you wish to restrict the visibility of the radar area to. (Server function only)
Example
Click to collapse [-]
ServerThis example creates a radar area for the King of the hill script, and a colsquare. When the player enters the radar area it flashes, and stops flashing when a player leaves it.
-- create our hill area for our gamemode
local hillArea = createColRectangle ( -2171.0678710938, 678.17950439453, 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
if (getElementType(thePlayer) == "player") then
outputChatBox( getPlayerName(thePlayer) .. " entered the zone!", getRootElement(), 255, 255, 109 )
setRadarAreaFlashing ( hillRadar, true )
end
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 (getElementType(thePlayer) == "player") then
if isPedDead ( thePlayer ) ~= true then
-- if he was alive, announce to everyone that the player has left the hill
outputChatBox ( getPlayerName(thePlayer) .. " left the zone!", getRootElement(), 255, 255, 109 )
setRadarAreaFlashing ( hillRadar, false )
end
end
end
addEventHandler ( "onColShapeLeave", hillArea, hill_Exit )
See Also
- createRadarArea
- getRadarAreaColor
- getRadarAreaSize
- isInsideRadarArea
- isRadarAreaFlashing
- setRadarAreaColor
- setRadarAreaFlashing
- setRadarAreaSize