SA-MP Forums Archive
Checking inventory? - 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: Checking inventory? (/showthread.php?tid=277020)



Checking inventory? - Shockey HD - 16.08.2011

Is there a way to check to see if a player has a gun?

I know the base but what about the function?

My goal is to show it in a message


Re: Checking inventory? - Dr - 16.08.2011

Do you use some sort of saving system for weapons? If so you can check if the variable for the weapon is there and then, I will use a enum for the example:
pawn Код:
if(gPlayerInfo[playerid][pGun02] == 24)
{
SendClientMessage(playerid, COLOR, "You have a deagle");
return 1;
}



Respuesta: Checking inventory? - Alex_Obando - 16.08.2011

I made this for you:

pawn Код:
#include <a_samp>


#define FILTERSCRIPT

#if defined FILTERSCRIPT

#define COLOR_RED 0xFF0000AA

new banning[MAX_PLAYERS];

forward banningtimer();//timer for when getting banned
forward weaponanti();//checks if a player has an illegal weapon


#endif
public banningtimer()
{
    for (new i = 0; i < MAX_PLAYERS; i++)
        {
       if(banning[i] == 1)
     {

     }
    }
}

public weaponanti()
{
    for (new i = 0; i < MAX_PLAYERS; i++)
     {
       if (GetPlayerWeapon(i) == 38)
    {
           new pname[200];
           new string[200];
           new ammo = GetPlayerAmmo(i);
           new plrIP[16];
           GetPlayerIp(i, plrIP, sizeof(plrIP));
           GetPlayerName(i, pname, sizeof(pname));
           format(string,sizeof(string),"%s [ID: %d] [IP:%s] is suspected of having Minigun Hacks (Ammo: %i) [Use /getinfo %d]",pname,i,plrIP,ammo,i);
           SendClientMessage(i, COLOR_RED, string);
           SetTimer("banningtimer",15000,0);
           banning[i] =1;
       }
       
          }
}



Re: Checking inventory? - Shockey HD - 16.08.2011

No saving for guns. The Gun system is Via Ranks


Re: Checking inventory? - Dr - 16.08.2011

Maybe this is what you are looking for?

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


Re: Checking inventory? - PrawkC - 16.08.2011

GetPlayerWeapon(playerid)


Re: Checking inventory? - Scenario - 16.08.2011

Quote:
Originally Posted by Dr
Посмотреть сообщение
Maybe this is what you are looking for?

https://sampwiki.blast.hk/wiki/GetPlayerWeaponData
That would be the function you should use.