Player::setWeaponAmmo

From RAGE Multiplayer Wiki
Revision as of 07:58, 15 June 2018 by MrPancakers (talk | contribs) (Created page with "Sets the amount of ammo for the selected weapon == Syntax == <syntaxhighlight lang="javascript"> player.setWeaponAmmo(weaponHash, ammo); </syntaxhighlight> === Parameters =...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Sets the amount of ammo for the selected weapon

Syntax

player.setWeaponAmmo(weaponHash, ammo);

Parameters

  • weaponHash: Int
  • ammo: Int

Examples

Gives you a weapon and lets you change the amount of ammo for that weapon. We use the assault rifle weapon has in this example.

mp.events.addCommand('weapon', (player) => {
    player.giveWeapon(3220176749, 1000);
})

mp.events.addCommand('setammo', (player, _, ammo) => {
    player.setWeaponAmmo(3220176749, parseInt(ammo));
});

See Also