Entity::getOwnVariable: Difference between revisions

From RAGE Multiplayer Wiki
m (Undone translations)
No edit summary
Line 1: Line 1:
__TOC__
__TOC__
{{ServersideJsFunction}}
{{JSContainer|


{{ServersideJsFunction}}
Gets the value of the key set with [[Entity::setOwnVariable|player.setOwnVariable(key, value)]].


Allows to get the value set with [[Entity::setOwnVariable|entity.setOwnVariable(key, value)]].
=== Required Params===
*{{Required}}'''key''': {{RageType|String}}


{{JSContainer|
==Syntax==
==Syntax==
<pre>
<pre>
entity.getOwnVariable(key);
player.getOwnVariable(key);
</pre>
</pre>
=== Required Arguments ===
*{{Required}}'''entity''': {{RageType|Object}}
*{{Required}}'''key''': {{RageType|String}}


==Example==
==Example==

Revision as of 18:41, 29 May 2024

Server-Side
Function

 JavaScript



JavaScript Syntax


Gets the value of the key set with player.setOwnVariable(key, value).

Required Params

  • *key: String

Syntax

player.getOwnVariable(key);

Example

This will set the job id for this player, which will only be available to him.

Server-Side
player.setOwnVariable("jobId", 9);


So we get the value that we set earlier.

Server-Side
player.getOwnVariable("jobId"); // 9


See More