Player::giveWeapon: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
No edit summary
Line 24: Line 24:
});
});
</syntaxhighlight>
</syntaxhighlight>
==See Also==
{{Player_block}}

Revision as of 13:41, 17 April 2017

This function gives a weapon for the player.

Syntax

player.giveWeapon(Number/Array weaponHash, Number ammo)

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