CreateBlip: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
 
(73 intermediate revisions by 35 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
This fake function is for use with blah & blah and does blahblahblabhalbhl
{{Server client function}}
 
This function creates a [[blip]] [[element]], which is displayed as an icon on the client's radar.
==Syntax==
<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, visibleTo=getRootElement()] )</syntaxhighlight>


==Syntax==
<section name="Server" class="server" show="true">
<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, int ordering = 0, float visibleDistance = 16383.0, element visibleTo = getRootElement( ) ] )
</syntaxhighlight>
</section>
<section name="Client" class="client" show="true">
<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, int ordering = 0, float visibleDistance = 16383.0 ] )
</syntaxhighlight>
</section>
[[File:Blip-New.png|thumb|example]]
{{OOP||[[Blip]]}}
===Required Arguments===  
===Required Arguments===  
*'''x:''' The x position of the blip, in [[world coordinates]].
*'''x:''' The x position of the blip, in world coordinates.
*'''y:''' The y 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 cocoordinates]].
*'''z:''' The z position of the blip, in world coordinates.


===Optional Arguments===  
===Optional Arguments===  
{{OptionalArg}}  
{{OptionalArg}}  
*'''icon:''' The icon that the radar blips should be. Valid values are:
*'''icon:''' The icon that the radar blips should be. Default is 0. Valid values can be seen at [[Radar Blips]]
** '''0:''' Border [default]
*'''size:''' The size of the radar blip. Only applicable to the ''Marker'' icon. Default is 2. Maximum is 25.
** '''1:''' Centre
*'''r:''' The amount of red in the blip's color (0–255). Only applicable to the ''Marker'' icon. Default is 255.
** '''2:''' Map_here
*'''g:''' The amount of green in the blip's color (0–255). Only applicable to the ''Marker'' icon. Default is 0.
** '''3:''' North
*'''b:''' The amount of blue in the blip's color (0–255). Only applicable to the ''Marker'' icon. Default is 0.
** '''4:''' Airyard
*'''a:''' The amount of alpha in the blip's color (0–255). Only applicable to the ''Marker'' icon. Default is 255.
** '''5:''' Gun
{{New feature/item|3|1.0||
** '''6:''' Barbers
*'''ordering:''' This defines the blip's Z-level ordering (-32768–32767). Default is 0.
** '''7:''' Big_smoke
*'''visibleDistance:''' The maximum distance from the camera at which the blip is still visible (0–65535).
** '''8:''' Boatyard
}}
** '''9:''' Burgershot
<section name="Server" class="server" show="true">
** '''10:'''Bulldozer
*'''visibleTo:''' This defines which elements can see the blip. Defaults to visible to everyone. See [[visibility]].
** '''11:'''Cat_pink
</section>
** '''12:'''Cesar
 
** '''13:'''Chicken
==Returns==
** '''14:'''Cj
Returns an [[element]] of the [[blip]] if it was created successfully, ''false'' otherwise.
** '''15:'''Crash1
** '''16:'''Diner
** '''17:''' Emmetgun
** '''18:''' Enemyattack
** '''19:''' Fire
** '''20:''' Girlfriend
** '''21:''' Hospital
** '''22:''' Loco
** '''23:''' Maddog
** '''24:''' Mafia
** '''25:''' Mcstrap
** '''26:''' Mod_garage
** '''27:''' Ogloc
** '''28:''' Pizza
** '''29:''' Police
** '''30:''' Property_green
** '''13:''' Property_red
** '''32:''' Race
** '''33:''' Ryder
** '''34:''' Savehouse
** '''35:''' School
** '''36:''' Mystery
** '''36:''' Sweet
** '''38:''' Tattoo
** '''39:''' Truth
** '''40:''' Waypoint
** '''41:''' Toreno_ranch
** '''42:''' Triads
** '''43:''' Triads_casino
** '''44:''' Tshirt
** '''45:''' Woozie
** '''46:''' Zero
** '''47:''' Date_disco
** '''48:''' Date_drink
** '''49:''' Date_food
** '''50:''' Truck
** '''51:''' Cash
** '''52:''' Flag
** '''53:''' Gym
** '''54:''' Impound
** '''55:''' Runway_light
** '''56:''' Runway
** '''57:''' Gang_b
** '''58:''' Gang_p
** '''59:''' Gang_y
** '''60:''' Gang_n
** '''61:''' Gang_g
** '''62:''' Spray
*'''size:''' The size of the radar blip. Default is 2.
*'''r:''' The ammount of red in the blip's color (0 - 255). Default is 255.
*'''g:''' The ammount of green in the blip's color (0 - 255). Default is 0.
*'''b:''' The ammount of blue in the blip's color (0 - 255). Default is 0.
*'''a:''' The ammount of alpha in the blip's color (0 - 255). Default is 255.
* '''visibleTo:''' What elements can see the blip. Defaults to visible to everyone. See [[visibility]].


==Example==  
==Example==  
This example creates a radar blip at a random player's position and makes it so that it is only visible to that player.
<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.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- Pick a random player
-- Pick a random player
myPlayer = getRandomPlayer ()
local myPlayer = getRandomPlayer( )
-- Retrieve the player's position and store it in the variables x, y and z
-- Retrieve the player's position and store it in the variables x, y and z
x,y,z = getEntityPosition ( myPlayer )
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
-- 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, 255, 0, 255, myPlayer )
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.
<syntaxhighlight lang="lua">
-- Pick a random player
local myPlayer = getRandomPlayer( )
-- Create a radar blip in the middle of the map
local myBlip = createBlip( 0, 0, 0 )
-- Make the player the parent of the blip, so that the blip follows the player around
setElementParent( myBlip, myPlayer )
</syntaxhighlight>
</section>
==See Also==
{{Blip_functions}}
[[HU:createBlip]]
[[AR:createBlip]]
[[DE:createBlip]]
[[ES:CreateBlip]]
[[IT:createBlip]]
[[PL:createBlip]]
[[RO:createBlip]]

Latest revision as of 15:04, 11 June 2023

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 = 16383.0, element visibleTo = getRootElement( ) ] )
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 = 16383.0 ] )
example

OOP Syntax Help! I don't understand this!

Method: Blip(...)


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. Default is 0. Valid values can be seen at Radar Blips
  • size: The size of the radar blip. Only applicable to the Marker icon. Default is 2. Maximum is 25.
  • 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 (0–65535).
Click to collapse [-]
Server
  • visibleTo: This defines which elements can see the blip. Defaults to visible to everyone. See visibility.

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
local myPlayer = getRandomPlayer( )
-- 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 )

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
local myPlayer = getRandomPlayer( )
-- Create a radar blip in the middle of the map
local myBlip = createBlip( 0, 0, 0 )
-- Make the player the parent of the blip, so that the blip follows the player around
setElementParent( myBlip, myPlayer )

See Also