CreateRadarArea: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
This function can be used to create custom radar areas on the radar. | This function can be used to create custom radar areas on the radar. | ||
Line 26: | Line 25: | ||
==Example== | ==Example== | ||
This example creates a radar area when a player spawns, only | This example creates a radar area when a player spawns, only visible to himself. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
addEventHandler ( "onPlayerSpawn", root, "playerSpawn" ) --add an event handler for onPlayerSpawn | addEventHandler ( "onPlayerSpawn", root, "playerSpawn" ) --add an event handler for onPlayerSpawn | ||
function playerSpawn ( | function playerSpawn () --when a player spawns | ||
createRadarArea ( 0, 0, 5, 5, 0, 255, 0, 150, source ) --create a green radar area at 0, 0 which is only visible to the player | createRadarArea ( 0, 0, 5, 5, 0, 255, 0, 150, source ) --create a green radar area at 0, 0 which is only visible to the player | ||
end | end |
Revision as of 16:28, 11 March 2007
This function can be used to create custom radar areas on the radar.
Syntax
radararea createRadarArea ( float x, float y, float sizex, float sizey, int r, int g, int b, int a, [ visibleTo=getRootElement () ] )
Required Arguments
- x: A float representing the origin 'x' position of the radar area
- y: A float representing the origin 'y' position of the radar area
- sizex: A float representing the width of the radar area, going in an east direction
- sizey: A float representing the height of the radar area, going in a south direction
- r: An integer representing the amount of red in the color. Maximum value is 255
- g: An integer representing the amount of green in the color. Maximum value is 255
- b: An integer representing the amount of blue in the color. Maximum value is 255
- a: An integer representing the amount of alpha in the color. This allows setting the transparency of the radar area. 255 is opaque and 0 is transparent.
Note: The origin position specified by the x and y arguments is the bottom left (or south west) corner of the 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 or elements that you wish to restrict the visibility of the radar area to.
Example
This example creates a radar area when a player spawns, only visible to himself.
addEventHandler ( "onPlayerSpawn", root, "playerSpawn" ) --add an event handler for onPlayerSpawn function playerSpawn () --when a player spawns createRadarArea ( 0, 0, 5, 5, 0, 255, 0, 150, source ) --create a green radar area at 0, 0 which is only visible to the player end
See Also
- createRadarArea
- getRadarAreaColor
- getRadarAreaSize
- isInsideRadarArea
- isRadarAreaFlashing
- setRadarAreaColor
- setRadarAreaFlashing
- setRadarAreaSize