SA-MP Forums Archive
How to detect if player has any weapons ? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to detect if player has any weapons ? (/showthread.php?tid=580783)



How to detect if player has any weapons ? - Adarsh007 - 08.07.2015

Hello !

Can anyone tell me, How can I detect if a player has any weapons ? (Not Melee weapons)

Thanks in advance


Re: How to detect if player has any weapons ? - SoFahim - 08.07.2015

This? GetPlayerWeapon


Re: How to detect if player has any weapons ? - Adarsh007 - 08.07.2015

No :/

I want to Detect if a Player has Even a Single GUN. and
GetPlayerWeapon is used for Detecting a Single Weapon ID. or More But "ID" and I want "any" weapon.


Re: How to detect if player has any weapons ? - youssefehab500 - 08.07.2015

PHP Code:
if(GetPlayerWeapon(playerid) == 24 || GetPlayerWeapon == 26)/*Random ids*/ 
You can add what ids you want to detect.


Re: How to detect if player has any weapons ? - Adarsh007 - 08.07.2015

I tried it but not worked :/


Re: How to detect if player has any weapons ? - youssefehab500 - 08.07.2015

Alright, then explain more. What weapons do you want to detect and why. And show us the part of the code you want it implemented in.


Re: How to detect if player has any weapons ? - M4D - 08.07.2015

player can carry only 1 weapon in every slot
there are 13 slots !
so Get Player Weapon Data For Every slot and check weapon ID.
you can ignore melee weapons slot !

https://sampwiki.blast.hk/wiki/GetPlayerWeaponData

explain more about what exactly want


Re: How to detect if player has any weapons ? - Adarsh007 - 08.07.2015

Fixed it my self....Just Defined the ID(s) and done the job
Thanks Everyone