GivePlayerWeapon: Difference between revisions
(Created page with "Gives the given player a weapon of the given type. See also Weapons Models. ==Syntax== <syntaxhighlight lang="C#">void NAPI.Player.GivePlayerWeapon(Client player, WeaponH...") |
No edit summary |
||
| Line 2: | Line 2: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="C#">void NAPI.Player.GivePlayerWeapon( | <syntaxhighlight lang="C#">void NAPI.Player.GivePlayerWeapon(Player player, WeaponHash weaponHash, int ammo);</syntaxhighlight> | ||
*'''player:''' parameter input should be in ''' | *'''player:''' parameter input should be in '''Player''' type. | ||
*'''weaponHash:''' parameter input should be in '''WeaponHash''' type. | *'''weaponHash:''' parameter input should be in '''WeaponHash''' type. | ||
*'''ammo:''' parameter input should be in '''int''' type. | *'''ammo:''' parameter input should be in '''int''' type. | ||
| Line 14: | Line 14: | ||
// Use as: /weapon smg | // Use as: /weapon smg | ||
[Command("weapon")] | [Command("weapon")] | ||
public void WeaponCommand( | public void WeaponCommand(Player sender, WeaponHash hash) | ||
{ | { | ||
NAPI.Player.GivePlayerWeapon(sender, hash, 500); | NAPI.Player.GivePlayerWeapon(sender, hash, 500); | ||
Latest revision as of 21:51, 22 December 2022
Gives the given player a weapon of the given type. See also Weapons Models.
Syntax
void NAPI.Player.GivePlayerWeapon(Player player, WeaponHash weaponHash, int ammo);
- player: parameter input should be in Player type.
- weaponHash: parameter input should be in WeaponHash type.
- ammo: parameter input should be in int type.
Note: All the weapons in a slot share the same ammo.
Usage example(s)
// Use as: /weapon smg
[Command("weapon")]
public void WeaponCommand(Player sender, WeaponHash hash)
{
NAPI.Player.GivePlayerWeapon(sender, hash, 500);
}