Entity::setVariable

From RAGE Multiplayer Wiki

Set custom data to an entity. These variables are visible only server side.
See Entity::setVariables to set multiple variables in bulk.

Server-Side
Function

 JavaScript



JavaScript Syntax

Syntax

// To set one variable at a time
entity.setVariable(name, value);

// To set multiple variables at a time.
entity.setVariable({name1: value1, name2: value2});

Required Arguments

  • *entity: Object
  • *name: String
  • *value: Any

Example

This binds the vehicle to the player

Server-Side
let veh = mp.vehicles.new(vehName, player.position);
player.setVariable('veh', veh);



See More