Globals::joaat: Difference between revisions

From RAGE Multiplayer Wiki
(Created page with "This function generates hashes/arrays of hashes (hash is integer) using strings/arrays of strings. Those hashes could be used to set entity model. ==Syntax== <syntaxhighligh...")
 
m (Fix types)
 
(12 intermediate revisions by 7 users not shown)
Line 1: Line 1:
This function generates hashes/arrays of hashes (hash is integer) using strings/arrays of strings. Those hashes could be used to set entity model.
This function generates hashes/arrays of hashes (hash is integer) using strings/arrays of strings. Those hashes could be used to set entity model.


The name "joaat" stands for [[wikipedia:en:Jenkins_hash_function#one_at_a_time|'''Jenkin's One At A Time''']] hashing function.


==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">
{{ServersideCode|
events.call(eventName, optionalArguments);
<pre>
</syntaxhighlight>  
mp.joaat(key: String): Number;
mp.joaat(keys: String[]): Number[]
</pre>
}}


==Example==
 
<syntaxhighlight lang="javascript">
{{ClientsideCode|
console.log(mp.joaat("bati")); // 4180675781
<pre>
console.log(mp.joaat(["bati", "benson"])); // [4180675781, 2053223216]
mp.game.joaat(key: String): Number;
</syntaxhighlight>
mp.game.joaat(keys: String[]): Number[];
</pre>
}}
 
==Examples==
{{ServersideCode|
<pre>
mp.joaat("bati");
mp.joaat(["bati", "benson"]);
</pre>
}}
 
 
{{ClientsideCode|
<pre>
mp.game.joaat("bati");
mp.game.joaat(["bati", "benson"]);
</pre>
}}
 
== See also ==
* [https://wiki.gtanet.work/index.php?title=GetHashKey GetHashKey] - Similar function in C# Bridge
{{GameGlobals}}
 
[[Category:Server-side Function]]
[[Category:Client-side Function]]
[[Category:Shared Function]]

Latest revision as of 12:10, 17 December 2021

This function generates hashes/arrays of hashes (hash is integer) using strings/arrays of strings. Those hashes could be used to set entity model.

The name "joaat" stands for Jenkin's One At A Time hashing function.

Syntax

Server-Side
mp.joaat(key: String): Number;
mp.joaat(keys: String[]): Number[]


Client-Side
mp.game.joaat(key: String): Number;
mp.game.joaat(keys: String[]): Number[]; 

Examples

Server-Side
mp.joaat("bati");
mp.joaat(["bati", "benson"]);


Client-Side
mp.game.joaat("bati");
mp.game.joaat(["bati", "benson"]);

See also