Player::giveWeapon

From RAGE Multiplayer Wiki

This function gives a weapon(see) for the player.

Syntax

JavaScript Syntax

player.giveWeapon(Number weaponHash, Number ammo)
player.giveWeapon(Array weaponHash, Number ammo)
player.giveWeapon(Array weaponHash, Array ammo)
player.giveWeapon(Object weapons)

Example

Example 1. This example gives 1 weapon for player.

Server-Side
mp.events.add('weapon', (player, _, weapon = "weapon_specialcarbine_mk2") => {
    player.giveWeapon(mp.joaat(weapon), 1000);
});

Example 2. This example gives 2 weapons for player.

Server-Side
mp.events.add('playerCommand', (player, command) => {
  let arr = command.split(' ');
  if (arr[0] == 'weapon') {
    player.giveWeapon([3220176749, 2210333304], 1000); // Assault Rifle, Carbine Rifle
  }
});


See Also