Player::allWeapons: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
No edit summary
 
(2 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/>
<br/>
'''Note: this property is read-only.'''
'''Note: this property is read-only.'''
Line 8: 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