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
Line 1: Line 1:
Gets the players weapon's hash and ammo
Gets the players weapon's hash and ammo
<br/>
'''Note: this property is read-only.'''
== Syntax ==
== Syntax ==
<pre>
<pre>

Revision as of 23:43, 26 December 2020

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

Syntax

Object player.allWeapons;

Examples

It will show your weapon's 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