CreateBlip: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Szybki (talk | contribs)
Undo revision 39533 by Iromand (talk)
Iromand (talk | contribs)
Line 61: Line 61:
==Example==  
==Example==  
<section name="Server" class="server" show="true">
<section name="Server" class="server" show="true">
'''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.
'''مثال 1:''' احضار لاعب تلقائي واحضار احداثياته وثم ينشأ ايقونة على الاعب
<syntaxhighlight lang="lua">
local myPlayer = getRandomPlayer( ) -- احضار لاعب عشوائي
-- Pick a random player
local x, y, z = getElementPosition( myPlayer ) -- احضار احداثيات الاعب x,y,z
local myPlayer = getRandomPlayer( )
local myBlip = createBlip( x, y, z, 51, 0, 0, 0, 255, myPlayer ) -- انشاء علامة على الاعب
-- Retrieve the player's position and store it in the variables x, y and z
local x, y, z = getElementPosition( myPlayer )
-- Create a radar blip at the player's position, with a 'cash' icon and only visible to the player
local myBlip = createBlip( x, y, z, 51, 0, 0, 0, 255, myPlayer )
</syntaxhighlight>
</syntaxhighlight>


'''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.
'''مثال 1:''' عند موت الاعب. يتم انشاء الايقونة في احداثيات موته
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- Pick a random player
addEventHandler('onPlayerWasted', root, -- استخدام الحدث " عند موت الاعب " ء
local myPlayer = getRandomPlayer( )
      function()
-- Create a radar blip in the middle of the map
          local x, y, z = getElementPosition( source ) -- احضار احداثيات الاعب
local myBlip = createBlip( 0, 0, 0 )
          createBlip(x, y, z, 51) -- انشاء ايقونة في احداثيات موت الاعب
-- Make the player the parent of the blip, so that the blip follows the player around
    end
setElementParent( myBlip, myPlayer )
  )
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>

Revision as of 13:43, 15 May 2014

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       If higher than player:   If lower than player:
  • 1: White_square Note: it's actually white, darkened for display here
  • 2: Centre
  • 3: Map_here
  • 4: North
  • 5: Airyard
  • 6: Gun
  • 7: Barbers
  • 8: Big_smoke
  • 9: Boatyard
  • 10: Burgershot
  • 11: Bulldozer
  • 12: Cat_pink
  • 13: Cesar
  • 14: Chicken
  • 15: Cj
  • 16: Crash1
  • 17: Diner
  • 18: Emmetgun
  • 19: Enemyattack
  • 20: Fire
  • 21: Girlfriend
  • 22: Hospital
  • 23: Loco
  • 24: Madd Dogg
  • 25: Mafia
  • 26: Mcstrap
  • 27: Mod_garage
  • 28: Ogloc
  • 29: Pizza
  • 30: Police
  • 31: Property_green
  • 32: Property_red
  • 33: Race
  • 34: Ryder
  • 35: Savehouse
  • 36: School
  • 37: Mystery
  • 38: Sweet
  • 39: Tattoo
  • 40: Truth
  • 41: Waypoint
  • 42: Toreno_ranch
  • 43: Triads
  • 44: Triads_casino
  • 45: Tshirt
  • 46: Woozie
  • 47: Zero
  • 48: Date_disco
  • 49: Date_drink
  • 50: Date_food
  • 51: Truck
  • 52: Cash
  • 53: Flag
  • 54: Gym
  • 55: Impound
  • 56: Runway_light
  • 57: Runway
  • 58: Gang_b
  • 59: Gang_p
  • 60: Gang_y
  • 61: Gang_n
  • 62: Gang_g
  • 63: Spray
  • 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: This defines which 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       If higher than player:   If lower than player:
  • 1: White_square Note: it's actually white, darkened for display here
  • 2: Centre
  • 3: Map_here
  • 4: North
  • 5: Airyard
  • 6: Gun
  • 7: Barbers
  • 8: Big_smoke
  • 9: Boatyard
  • 10: Burgershot
  • 11: Bulldozer
  • 12: Cat_pink
  • 13: Cesar
  • 14: Chicken
  • 15: Cj
  • 16: Crash1
  • 17: Diner
  • 18: Emmetgun
  • 19: Enemyattack
  • 20: Fire
  • 21: Girlfriend
  • 22: Hospital
  • 23: Loco
  • 24: Madd Dogg
  • 25: Mafia
  • 26: Mcstrap
  • 27: Mod_garage
  • 28: Ogloc
  • 29: Pizza
  • 30: Police
  • 31: Property_green
  • 32: Property_red
  • 33: Race
  • 34: Ryder
  • 35: Savehouse
  • 36: School
  • 37: Mystery
  • 38: Sweet
  • 39: Tattoo
  • 40: Truth
  • 41: Waypoint
  • 42: Toreno_ranch
  • 43: Triads
  • 44: Triads_casino
  • 45: Tshirt
  • 46: Woozie
  • 47: Zero
  • 48: Date_disco
  • 49: Date_drink
  • 50: Date_food
  • 51: Truck
  • 52: Cash
  • 53: Flag
  • 54: Gym
  • 55: Impound
  • 56: Runway_light
  • 57: Runway
  • 58: Gang_b
  • 59: Gang_p
  • 60: Gang_y
  • 61: Gang_n
  • 62: Gang_g
  • 63: Spray
  • 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

مثال 1: احضار لاعب تلقائي واحضار احداثياته وثم ينشأ ايقونة على الاعب local myPlayer = getRandomPlayer( ) -- احضار لاعب عشوائي local x, y, z = getElementPosition( myPlayer ) -- احضار احداثيات الاعب x,y,z local myBlip = createBlip( x, y, z, 51, 0, 0, 0, 255, myPlayer ) -- انشاء علامة على الاعب </syntaxhighlight>

مثال 1: عند موت الاعب. يتم انشاء الايقونة في احداثيات موته

 addEventHandler('onPlayerWasted', root, -- استخدام الحدث " عند موت الاعب " ء
      function()
          local x, y, z = getElementPosition( source ) -- احضار احداثيات الاعب
          createBlip(x, y, z, 51)  -- انشاء ايقونة في احداثيات موت الاعب
     end 
  )

See Also