Player::weaponAmmo: Difference between revisions

From RAGE Multiplayer Wiki
(Created page with "Gets ammo from the current player's weapon <br/> '''Note: this property is read-only.''' == Syntax == <pre> Number player.weaponAmmo; </pre> ==Examples== It will show ammo fr...")
 
No edit summary
 
Line 1: Line 1:
Gets ammo from the current player's weapon
{{ServersideJsFunction}}
<br/>
{{JSContainer|
'''Note: this property is read-only.'''
Returns the amount of ammo from the current player's weapon
 
*'''Note: this property is read-only.'''
 
== Syntax ==
== Syntax ==
<pre>
<pre>
Number player.weaponAmmo;
player.weaponAmmo;
</pre>
</pre>


==Examples==
==Example==
It will show ammo from the current player's weapon
This command will show how many ammo the player has in his currently equipped weapon.
{{ServersideCode|
{{ServersideCode|
<pre>
<syntaxhighlight lang="javascript">
mp.events.addCommand('ammo', (player) => {
mp.events.addCommand('ammo', (player) => {
   player.notify(`Ammo: ${player.weaponAmmo}`);
   player.notify(`Ammo: ${player.weaponAmmo}`);
});
});
</pre>
</syntaxhighlight>
}}
}}
}}



Latest revision as of 08:04, 1 June 2024

Server-Side
Function

 JavaScript



JavaScript Syntax

Returns the amount of ammo from the current player's weapon

  • Note: this property is read-only.

Syntax

player.weaponAmmo;

Example

This command will show how many ammo the player has in his currently equipped weapon.

Server-Side
mp.events.addCommand('ammo', (player) => {
  player.notify(`Ammo: ${player.weaponAmmo}`);
});


See Also