SetEntityDimension

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

Sets an entity into a dimension.


Dialog-warning.png NOTE: Client-sided and server-sided dimensions are not synced. You will get different values if you set them seperately.

Syntax

API.setEntityDimension(NetHandle entity, int dimension);

Required Arguments

  • entity: parameter input should be in NetHandle type.
  • dimension: parameter input should be in int type.


New Feature since Update v0.1.638.634

Dimensions Visibility:

  • Dimension 0 is visible to all in dimension 0 and above
  • All dimensions above 0 can only see entities in their dimension + dimension 0
  • All dimensions below 0 are private dimensions and can only see the entities in their dimension.


Example of a Visibility Scenario:

  • Player A is dimension 0, Player B in dimension 1, Player C in dimension 1, Player D in dimension 1337 and Player E in dimension -3.
  • All player except Player E will see Player A.
  • Player E won't see anybody else, as hes in a lonely private dimension.
  • Player B can see Player C and the other way around too, both can see Player A.
  • Player D can only see Player A.

Usage example(s)

The command below puts the player into a given virtual world.

In C#
Server-Side Function

[Command("dimension", "Usage: /dimension <dimension_id>")]
public void SetMyDimension(Client player, int world)
{
    API.setEntityDimension(player, world);
}

The code below will set a player's dimension to 5 on client-side.

In Javascript
Client-Side Function

var player = API.getLocalPlayer();
API.setEntityDimension(player, 5);

References