Entity::setOwnVariables

From RAGE Multiplayer Wiki
Revision as of 09:09, 29 April 2021 by Update450 (talk | contribs) (Created page with "{{ServersideJsFunction}} Set multiple custom data variables that will be only available to an entity. {{JSContainer| ==Syntax== <pre> entity.setOwnVariables({'variable1': va...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Server-Side
Function

Js.png JavaScript



Set multiple custom data variables that will be only available to an entity.

JavaScript Syntax
Jslogo.png

Syntax

entity.setOwnVariables({'variable1': value1, 'variable2': value2});

Example

This will set the multiple values for specific player, which will only be available to him.

Server-Side
player.setOwnVariables({
    'foo': 'bar',
    'beast': true
});

Now variables can be used on client-side but they will be only available for player specified on server-side.

Client-Side
mp.players.local.getVariable('foo'); // 'bar'
mp.players.local.getVariable('beast'); // true



See More