CreateRadarArea

From Multi Theft Auto: Wiki
Revision as of 13:13, 14 August 2006 by Talidan (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 starting 'x' position of the radar area
  • y: A float representing the starting '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.

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 if the player is in the 'grovestreet' team.

addEventHandler ( "onPlayerSpawn", root, "onPlayerSpawn" ) --add an event handler for onPlayerSpawn
function onPlayerSpawn ( spawnpoint ) --when a player spawns
    createRadarArea ( 0, 0, 5, 5, 0, 255, 0, 150, grovestreet ) --create a green radar area at 0, 0 which is only visible to the 'grovestreet' team
end

See Also