CreateRadarArea

From Multi Theft Auto: Wiki
Revision as of 16:28, 11 March 2007 by Jbeta (talk | contribs)
Jump to navigation Jump to search

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