Player::giveWeapon: Difference between revisions
No edit summary |
No edit summary |
||
| Line 4: | Line 4: | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
player.giveWeapon(Number/Array weaponHash, Number ammo) | player.giveWeapon(Number/Array weaponHash, Number ammo) | ||
</syntaxhighlight> | |||
== Example == | |||
'''Example 1'''. This example gives 1 weapon for player. | |||
<syntaxhighlight lang="javascript"> | |||
mp.events.add('playerCommand', (player, command) => { | |||
let arr = command.split(' '); | |||
if (arr[0] == 'weapon') { | |||
player.giveWeapon(3220176749, 1000); // Assault Rifle | |||
} | |||
}); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 16:48, 4 January 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
}
});