Entity::getVariable: Difference between revisions

From RAGE Multiplayer Wiki
(Cleaned up page)
Line 1: Line 1:
__NOTOC__
__NOTOC__
 
Retrieves the custom data from the entity.
'''Function''': Gets a custom data from an entity.


==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">
<pre>
value entity.getVariable(name); // Returns null if key 'name' does not exist.
entity.getVariable('variableName');
</syntaxhighlight>
</pre>


==Example==
==Example==
{{Shared}}
This example will retrieve the data from the variable 'veh' that is assigned to the player
<syntaxhighlight lang="javascript">
<div class="header" style="background-color: #00baad; color: #FFFFFF; border: 2px solid #00baad;">
// Supposed you want to get a vehicle you bound with a player
<div style="margin: 10px 10px 10px 10px;"><b>Shared</b></div>
<pre>
let veh = player.getVariable('veh');
let veh = player.getVariable('veh');
</syntaxhighlight>
</pre>
</div>
 
== See More ==
{{Entity_functions}}

Revision as of 01:56, 29 September 2018

Retrieves the custom data from the entity.

Syntax

entity.getVariable('variableName');

Example

This example will retrieve the data from the variable 'veh' that is assigned to the player

Shared
let veh = player.getVariable('veh');

See More