createBlip | Multi Theft Auto: Wiki Skip to content

createBlip

Client-side
Server-side
Shared

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

OOP Syntax Help! I don't understand this!

  • Constructor: Blip(...)

Client Syntax

blip|false 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 ] )
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.

  • icon (default: 0): The icon that the radar blips should be. Default is 0. Valid values can be seen at Radar Blips.
  • size (default: 2): The size of the radar blip. Only applicable to the Marker icon. Default is 2. Maximum is 25.
  • r (default: 255): The amount of red in the blip's color (0-255). Only applicable to the Marker icon. Default is 255.
  • g (default: 0): The amount of green in the blip's color (0-255). Only applicable to the Marker icon. Default is 0.
  • b (default: 0): The amount of blue in the blip's color (0-255). Only applicable to the Marker icon. Default is 0.
  • a (default: 255): The amount of alpha in the blip's color (0-255). Only applicable to the Marker icon. Default is 255.
  • ordering (default: 0): This defines the blip's Z-level ordering (-32768-32767). Default is 0.
  • visibleDistance (default: 16383.0): The maximum distance from the camera at which the blip is still visible (0-65535).

Returns

  • blip|false: created-blip

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

Server Syntax

blip|false 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() ] )
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.

  • icon (default: 0): The icon that the radar blips should be. Default is 0. Valid values can be seen at Radar Blips.
  • size (default: 2): The size of the radar blip. Only applicable to the Marker icon. Default is 2. Maximum is 25.
  • r (default: 255): The amount of red in the blip's color (0-255). Only applicable to the Marker icon. Default is 255.
  • g (default: 0): The amount of green in the blip's color (0-255). Only applicable to the Marker icon. Default is 0.
  • b (default: 0): The amount of blue in the blip's color (0-255). Only applicable to the Marker icon. Default is 0.
  • a (default: 255): The amount of alpha in the blip's color (0-255). Only applicable to the Marker icon. Default is 255.
  • ordering (default: 0): This defines the blip's Z-level ordering (-32768-32767). Default is 0.
  • visibleDistance (default: 16383.0): The maximum distance from the camera at which the blip is still visible (0-65535).
  • visibleTo (default: getRootElement()): This defines which elements can see the blip. Defaults to visible to everyone. See visibility.

Returns

  • blip|false: created-blip

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

Code Examples

server

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 )