SA-MP Forums Archive
Scan Player Help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Scan Player Help (/showthread.php?tid=192082)



Scan Player Help - Alex_Valde - 21.11.2010

Can someone help me with my idea?

I'm trying to make scanner that will scan player for ANY weapons, from Knuckles to Minigun.

Any idea how could I do that?
I tryed to use GetPlayerWeaponData but I can't make it to work...
Thanks for any suggestions.


Re: Scan Player Help - Mauzen - 21.11.2010

GetPlayerWeaponData is the right way. Loop through all weapon slots and check if the player has more than 0 ammo in there, or weapon 1 in slot 0 (brass knuckles)

(simple example, also detects camera etc)
pawn Код:
new weapon, ammo;
for(new i = 0; i < 11; i ++)
{
    GetPlayerWeaponData(playerid, i, weapon, ammo);
    if(weapon == 1 || ammo > 0)
    {
        //player has a weapon
    }
}



Re: Scan Player Help - Alex_Valde - 21.11.2010

Thanks mate!
I'll try to script something like the code you made me right away.
I've never thought of searching for players ammo.