From GT-MP
Jump to: navigation, search
Server-Side Function
Utilities-terminal.png Server-Side Csharp.png C#

This function returns the components of the given player's specified weapon.


API.getPlayerWeaponComponents(Client player, WeaponHash weapon);

Required Arguments

  • player: parameter input should be in Client type.
  • weapon: parameter input should be in WeaponHash type.

NOTE: This function returns data in WeaponComponent[] type.

Usage example(s)

/listcomps command that lists the components of the weapon you're holding:

public void CMD_ListComps(Client player)
    WeaponComponent[] comps = API.getPlayerWeaponComponents(player, API.getPlayerCurrentWeapon(player));

    foreach (WeaponComponent comp in comps)
        API.sendChatMessageToPlayer(player, "Component: " + comp);