From GTA Network Wiki
Jump to navigation Jump to search

Server-Side Function

utilities-terminal.png Server-Side csharp.png C#

This function will tell you which weapon has the player in the hand. See also Weapons Models.


WeaponHash NAPI.Player.GetPlayerCurrentWeapon(Client player);

Required Arguments

  • player: parameter input should be in Client type.

NOTE: This function returns data in WeaponHash type.

Usage example(s)

The example shows an in-game command which will first print out the actual hash code number and on the next line it will display the name of the weapon in use.

public void CheckGun(Client player)
     WeaponHash hashcode = NAPI.Player.GetPlayerCurrentWeapon(player);
     NAPI.Chat.SendChatMessageToPlayer(player, "You have a weapon with hash code " + (int)hashcode + "!");
     NAPI.Chat.SendChatMessageToPlayer(player, "The weapon name is " + hashcode + "!");


Version Description
1.0 Release.