Player::giveWeapon

From RAGE Multiplayer Wiki
Jump to navigation Jump to search

This function gives a weapon for the player.

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.

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

Example 2. This example gives 2 weapons for player.

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