CreateBlip: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 7: Line 7:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
blip createBlip ( float x, float y, float z, [int icon=0, int size=2, int r=255, int g=0, int b=0, int a=255,  
blip createBlip ( float x, float y, float z, [int icon=0, int size=2, int r=255, int g=0, int b=0, int a=255,  
int ordering=0 *, float visibleDistance=99999.0, visibleTo = getRootElement()] )
int ordering=0, float visibleDistance=99999.0, visibleTo = getRootElement()] )
</syntaxhighlight>  
</syntaxhighlight>  



Revision as of 14:24, 22 January 2012

This function creates a blip element, which is displayed as an icon on the client's radar.

Syntax

Click to collapse [-]
Server
blip createBlip ( float x, float y, float z, [int icon=0, int size=2, int r=255, int g=0, int b=0, int a=255, 
int ordering=0, float visibleDistance=99999.0, visibleTo = getRootElement()] )

Required Arguments

  • x: The x position of the blip, in world coordinates.
  • y: The y position of the blip, in world coordinates.
  • z: The z position of the blip, in world coordinates.

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.

  • icon: The icon that the radar blips should be. Valid values are:
  • 0: Marker  Blipid0s.png     If higher than player: Blipid0u.png   If lower than player: Blipid0d.png
  • 1: White_square Blipid1b.png Note: it's actually white, darkened for display here
  • 2: Centre Blipid2.png
  • 3: Map_here Blipid3.png
  • 4: North Blipid4.png
  • 5: Airyard Blipid5.jpg
  • 6: Gun Blipid6.jpg
  • 7: Barbers Blipid7.jpg
  • 8: Big_smoke Blipid8.jpg
  • 9: Boatyard Blipid9.jpg
  • 10: Burgershot Blipid10.jpg
  • 11: Bulldozer Blipid11.jpg
  • 12: Cat_pink Blipid12.jpg
  • 13: Cesar Blipid13.jpg
  • 14: Chicken Blipid14.jpg
  • 15: Cj Blipid15.jpg
  • 16: Crash1 Blipid16.jpg
  • 17: Diner Blipid17.jpg
  • 18: Emmetgun Blipid18.jpg
  • 19: Enemyattack Blipid19.jpg
  • 20: Fire Blipid20.jpg
  • 21: Girlfriend Blipid21.jpg
  • 22: Hospital Blipid22.jpg
  • 23: Loco Blipid23.jpg
  • 24: Madd Dogg Blipid24.jpg
  • 25: Mafia Blipid25.jpg
  • 26: Mcstrap Blipid26.jpg
  • 27: Mod_garage Blipid27.jpg
  • 28: Ogloc Blipid28.jpg
  • 29: Pizza Blipid29.jpg
  • 30: Police Blipid30.jpg
  • 31: Property_green Blipid31.jpg
  • 32: Property_red Blipid32.jpg
  • 33: Race Blipid33.jpg
  • 34: Ryder Blipid34.jpg
  • 35: Savehouse Blipid35.jpg
  • 36: School Blipid36.jpg
  • 37: Mystery Blipid37.jpg
  • 38: Sweet Blipid38.jpg
  • 39: Tattoo Blipid39.jpg
  • 40: Truth Blipid40.jpg
  • 41: Waypoint Blipid41.png
  • 42: Toreno_ranch Blipid42.jpg
  • 43: Triads Blipid43.jpg
  • 44: Triads_casino Blipid44.jpg
  • 45: Tshirt Blipid45.jpg
  • 46: Woozie Blipid46.jpg
  • 47: Zero Blipid47.jpg
  • 48: Date_disco Blipid48.png
  • 49: Date_drink Blipid49.jpg
  • 50: Date_food Blipid50.jpg
  • 51: Truck Blipid51.jpg
  • 52: Cash Blipid52.jpg
  • 53: Flag Blipid53.jpg
  • 54: Gym Blipid54.jpg
  • 55: Impound Blipid55.jpg
  • 56: Runway_light Blipid56.jpg
  • 57: Runway Blipid57.jpg
  • 58: Gang_b Blipid58.jpg
  • 59: Gang_p Blipid59.jpg
  • 60: Gang_y Blipid60.jpg
  • 61: Gang_n Blipid61.jpg
  • 62: Gang_g Blipid62.jpg
  • 63: Spray Blipid63.jpg
  • size: The size of the radar blip. Only applicable to the Marker icon. Default is 2.
  • r: The amount of red in the blip's color (0 - 255). Only applicable to the Marker icon. Default is 255.
  • g: The amount of green in the blip's color (0 - 255). Only applicable to the Marker icon. Default is 0.
  • b: The amount of blue in the blip's color (0 - 255). Only applicable to the Marker icon. Default is 0.
  • a: The amount of alpha in the blip's color (0 - 255). Only applicable to the Marker icon. Default is 255.
  • ordering: This defines the blip's Z-level ordering (-32768 - 32767). Default is 0.
  • visibleDistance: The maximum distance from the camera at which the blip is still visible
  • visibleTo: What elements can see the blip. Defaults to visible to everyone. See visibility.
Click to collapse [-]
Client
blip createBlip ( float x, float y, float z, [int icon=0, int size=2, int r=255, int g=0, int b=0, int a=255, 
int ordering=0, float visibleDistance ] )

Required Arguments

  • x: The x position of the blip, in world coordinates.
  • y: The y position of the blip, in world coordinates.
  • z: The z position of the blip, in world coordinates.

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.

  • icon: The icon that the radar blips should be. Valid values are:
  • 0: Marker  Blipid0s.png     If higher than player: Blipid0u.png   If lower than player: Blipid0d.png
  • 1: White_square Blipid1b.png Note: it's actually white, darkened for display here
  • 2: Centre Blipid2.png
  • 3: Map_here Blipid3.png
  • 4: North Blipid4.png
  • 5: Airyard Blipid5.jpg
  • 6: Gun Blipid6.jpg
  • 7: Barbers Blipid7.jpg
  • 8: Big_smoke Blipid8.jpg
  • 9: Boatyard Blipid9.jpg
  • 10: Burgershot Blipid10.jpg
  • 11: Bulldozer Blipid11.jpg
  • 12: Cat_pink Blipid12.jpg
  • 13: Cesar Blipid13.jpg
  • 14: Chicken Blipid14.jpg
  • 15: Cj Blipid15.jpg
  • 16: Crash1 Blipid16.jpg
  • 17: Diner Blipid17.jpg
  • 18: Emmetgun Blipid18.jpg
  • 19: Enemyattack Blipid19.jpg
  • 20: Fire Blipid20.jpg
  • 21: Girlfriend Blipid21.jpg
  • 22: Hospital Blipid22.jpg
  • 23: Loco Blipid23.jpg
  • 24: Madd Dogg Blipid24.jpg
  • 25: Mafia Blipid25.jpg
  • 26: Mcstrap Blipid26.jpg
  • 27: Mod_garage Blipid27.jpg
  • 28: Ogloc Blipid28.jpg
  • 29: Pizza Blipid29.jpg
  • 30: Police Blipid30.jpg
  • 31: Property_green Blipid31.jpg
  • 32: Property_red Blipid32.jpg
  • 33: Race Blipid33.jpg
  • 34: Ryder Blipid34.jpg
  • 35: Savehouse Blipid35.jpg
  • 36: School Blipid36.jpg
  • 37: Mystery Blipid37.jpg
  • 38: Sweet Blipid38.jpg
  • 39: Tattoo Blipid39.jpg
  • 40: Truth Blipid40.jpg
  • 41: Waypoint Blipid41.png
  • 42: Toreno_ranch Blipid42.jpg
  • 43: Triads Blipid43.jpg
  • 44: Triads_casino Blipid44.jpg
  • 45: Tshirt Blipid45.jpg
  • 46: Woozie Blipid46.jpg
  • 47: Zero Blipid47.jpg
  • 48: Date_disco Blipid48.png
  • 49: Date_drink Blipid49.jpg
  • 50: Date_food Blipid50.jpg
  • 51: Truck Blipid51.jpg
  • 52: Cash Blipid52.jpg
  • 53: Flag Blipid53.jpg
  • 54: Gym Blipid54.jpg
  • 55: Impound Blipid55.jpg
  • 56: Runway_light Blipid56.jpg
  • 57: Runway Blipid57.jpg
  • 58: Gang_b Blipid58.jpg
  • 59: Gang_p Blipid59.jpg
  • 60: Gang_y Blipid60.jpg
  • 61: Gang_n Blipid61.jpg
  • 62: Gang_g Blipid62.jpg
  • 63: Spray Blipid63.jpg
  • size: The size of the radar blip. Only applicable to the Marker icon. Default is 2.
  • r: The amount of red in the blip's color (0 - 255). Only applicable to the Marker icon. Default is 255.
  • g: The amount of green in the blip's color (0 - 255). Only applicable to the Marker icon. Default is 0.
  • b: The amount of blue in the blip's color (0 - 255). Only applicable to the Marker icon. Default is 0.
  • a: The amount of alpha in the blip's color (0 - 255). Only applicable to the Marker icon. Default is 255.
  • ordering: This defines the blip's Z-level ordering (-32768 - 32767). Default is 0.
  • visibleDistance: The maximum distance from the camera at which the blip is still visible

Returns

Returns an element of the blip if it was created successfully, false otherwise.

Example

Click to collapse [-]
Server

Example 1: This example creates a radar blip at a random player's position and makes it so that it is only visible to that player.

-- Pick a random player
myPlayer = getRandomPlayer ()
-- Retrieve the player's position and store it in the variables x, y and z
x,y,z = getElementPosition ( myPlayer )
-- Create a radar blip at the player's position, with a 'cash' icon and only visible to the player
myBlip = createBlip ( x, y, z, 51, 0, 0, 0, 255, myPlayer )

Example 2: This example attaches a blip to a player. You can attach a blip to an element by just setting the blip's parent to that element.

-- Pick a random player
myPlayer = getRandomPlayer ()
-- Create a radar blip in the middle of the map
myBlip = createBlip ( 0, 0, 0 )
-- Make the player the parent of the blip, so that the blip follows the player around
setElementParent ( myBlip, myPlayer )

Example 3: This example creates a blip at 0 , 0 , 0

--creates a blip at 0 , 0 , 0
createBlip ( 0 , 0 , 0 , 37 )

See Also