CreateBlip

From GT-MP
Jump to: navigation, search
CreateBlip
Shared Function
Utilities-terminal.png Server-Side System-users.png Client-Side
Csharp.png C# Javascript.png JavaScript

Creates a blip either tied to an entity or static with range as an option and dimension.

Dialog-warning.png

Note: If shared API was used when creating, then the created entities are not deleted on ResourceStop


Icon-info.png
You can give the streaming Range of the blip when creating the blip using the createBlip(Vector3 pos, float range, int dimension) API.

A blip will be streamed in on the minimap:

  • if it's shortRanged and you are within the given stream range when creating the blip. (using just createBlip(pos) will create a shortranged blip with no range!)
  • if it's shortRanged and you are within the global_streaming_range-Setting
  • if it's attached to any other entity or not shortRanged


Syntax

In C#
Server-Side Function

Icon-info.png
This method is asynchronous. There is no guarantee the entity will be known to the client when working with it after creation (e.g. setting properties). Use waitForSynchronization() to make sure it's known.

waitForSynchronization() does not guarantee that the entity is streamed in on the client, it just means that the entity is known (and can be updated serverside). If you need to work with it on clientside you will need to check if the entity is streamed in (e.g. by hooking to the onEntityStreamIn event). Entities that are not streamed in can not be accessed using the clientside API. (Version 0.1.7)

This function has 3 overloads.

Blip API.createBlip(Vector3 pos, float range, int dimension = 0);
Blip API.createBlip(Vector3 pos, int dimension = 0);
Blip API.createBlip(NetHandle entity);

- Overload 1:

  • Creates a blip which can be seen within a specific range.
  • pos: Position of the blip. This parameter input should be in Vector3 type.
  • range: Range that the blip could be seen from. This parameter input should be in float type.
  • dimension: Optional: Dimension of the blip. Only players in the specified dimension will be able to see the blip. This parameter input should be in int type.

- Overload 2:

  • pos: Position of the blip. This parameter input should be in Vector3 type.
  • dimension: Optional: Dimension of the blip. Only players in the specified dimension will be able to see the blip. This parameter input should be in int type.

- Overload 3:

  • Creates a blip attached to a specified existing entity. The blip dimension will be the same as the entity's dimension.
  • entity: Entity to attach the blip to. This parameter input should be in NetHandle type.

NOTE: This function returns the Blip object as Blip type.

In Javascript
Client-Side Function

This function has 3 overloads.

LocalHandle API.createBlip(Vector3 pos);
LocalHandle API.createBlip(Vector3 pos, int dimension);
LocalHandle API.createBlip(LocalHandle entity);
Dialog-warning.png Overload 2 and 3 will be added in version 0.1.7


- Overload 1:

  • pos: parameter input should be in Vector3 type.

- Overload 2:

  • pos: parameter input should be in Vector3 type.
  • dimension: parameter input should be in int type.

- Overload 3:

  • entity: parameter input should be in LocalHandle type.

NOTE: This function returns data in LocalHandle type.

Icon-info.png

Use deleteEntity to delete a blip.


Usage example(s)

In C#
Server-Side Function

var myBlip = API.createBlip(pos);
var myBlip = API.createBlip(pos, 10f);
var myBlip = API.createBlip(myVehicle);

In Javascript
Client-Side Function

var myBlip = API.createBlip(pos);

References