Player::allWeapons: Difference between revisions

From RAGE Multiplayer Wiki
(Created page with "Gets the players weapon's hash and ammo == Syntax == <pre> Object player.allWeapons; </pre> ==Examples== It will show your weapon's hash and ammo {{ServersideCode| <pre> mp....")
 
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
Gets the players weapon's hash and ammo
Gets the player's weapon hash and ammo
<br/>
'''Note: this property is read-only.'''
== Syntax ==
== Syntax ==
<pre>
<pre>
Line 6: Line 8:


==Examples==
==Examples==
It will show your weapon's hash and ammo  
It will show player's weapon hash and ammo  
{{ServersideCode|
{{ServersideCode|
<pre>
<pre>

Latest revision as of 23:49, 26 December 2020

Gets the player's weapon hash and ammo
Note: this property is read-only.

Syntax

Object player.allWeapons;

Examples

It will show player's weapon hash and ammo

Server-Side
mp.events.addCommand('weapons', (player) => {
  const weapons = player.allWeapons;
  for (let key in weapons) {
    player.notify(`Hash: ${key}, ammo: ${weapons[key]}`);
  }
});

See Also