GivePlayerWeaponComponent

From GT-MP
Jump to: navigation, search
GivePlayerWeaponComponent
Shared Function
Utilities-terminal.png Server-Side System-users.png Client-Side
Csharp.png C# Javascript.png JavaScript

This function adds the specified component to the given player's specified weapon.


Syntax

API.givePlayerWeaponComponent(Client player, WeaponHash weapon, WeaponComponent component);

Required Arguments

  • player: parameter input should be in Client type.
  • weapon: parameter input should be in WeaponHash type.
  • component: parameter input should be in WeaponComponent type. See Weapons Components.

Usage example(s)

/weaponcomponent (/wcomp or /wc also works) from the freeroam resource, write /wcomp SpecialCarbineClip03 while holding a Special Carbine to give it the drum magazine component.

In C#
Server-Side Function

[Command("weaponcomponent", Alias = "wcomp,wc")]
public void GiveWeaponComponentCmd(Client sender, WeaponComponent component)
{
    API.givePlayerWeaponComponent(sender, API.getPlayerCurrentWeapon(sender), component);
}

References