getSelectedPedWeapon
GET_SELECTED_PED_WEAPON0x0A6DB4965674D243The GTA V native GET_SELECTED_PED_WEAPON of the WEAPON namespace, as LS:MP client scripts call it: the global function getSelectedPedWeapon, in JavaScript and in Lua.
getSelectedPedWeapon(ped: Ped): HashgetSelectedPedWeapon(ped: Ped): HashUsage
const hash = getSelectedPedWeapon(ped);local hash = getSelectedPedWeapon(ped)Parameters
| Parameter | Type | JavaScript | Lua |
|---|---|---|---|
ped | Ped | number | integer |
Returns
Hash JavaScript number, Lua integerA game hash. Natives return it unsigned (0 to 4294967295), the value lsmp.hash gives. As an argument, the signed and unsigned forms of a hash are the same value.
Notes
From the community native database. Names are LS:MP’s; samples may be written for C++ or another framework.
Returns the hash of the weapon.
var num7 = getSelectedPedWeapon(num4);
sub_27D3(num7);
switch (num7)
{
case 0x24B17070:Also see getCurrentPedWeapon. Difference?
The difference is that getSelectedPedWeapon simply returns the ped's current weapon hash but getCurrentPedWeapon also checks the weapon object and returns true if the hash of the weapon object equals the weapon hash
Full list of weapons by DurtyFree: https://github.com/DurtyFree/gta-v-data-dumps/blob/master/weapons.json
Reference
- Namespace
- Weapon WEAPON
- In the game
Hash GET_SELECTED_PED_WEAPON(Ped ped)- Hash
0x0A6DB4965674D243