Help - Check weapons a player
#2

Try this: (edit it based on your admin system):

PHP код:
CMD:getweps(playerid,params[])
{
      
      if(
PlayerInfo[playerid][Admin] >= 1)
      {
            new 
Target;
            new 
TW;
            if(!
sscanf(params"u"Target))
            {
                if(
Target == INVALID_PLAYER_ID) return SCM(playerid,red,"Wrong player ID.");
                new 
msg1[250], string2[64];
                new 
ammo;
                new 
name[MAX_PLAYER_NAME];
                
GetPlayerName(Target,name,sizeof(name));
                
format(string2,sizeof(string2),"_______ %s (%d)'s Weapons _______",name,Target);
                
SCM(playerid,COLOR_YELLOW,string2);
                for(new 
a=0<= 9a++)
                {
                    new 
weapon;
                    
GetPlayerWeaponData(Target,a,weapon,ammo);
                    if(
ammo != && weapon != 0)
                    {
                        new 
WeaponName[50], Ammo;
                        if(
ammo == -1Ammo 1;
                        else 
Ammo ammo;
                        if(
weapon == 18WeaponName "Molotov";
                        else 
GetWeaponName(weaponWeaponName64);
                        
format(msg1,128,"%s (ID:%d) - Ammo: %d"WeaponNameweaponAmmo);
                        
SCM(playerid,LIGHTBLUE,msg1);
                        
PlayerInfo[Target][AdminActions]++;
                        
TW++;
                    }
                }
                if(
TW == 0) return SCM(playerid,red,"This player is disarmed.");
                else {
                    
format(msg1,128,"Total Weapons: %d"TW);
                    
SCM(playerid,COLOR_YELLOW,msg1);
                }
                }
            else 
SCM(playerid,-1,"{F70505}Usage: {FFFFFF}/getweps <playerid>");
        }
        return 
1;

EDIT: Forgot the stock:

PHP код:
stock GetWeaponNameByID(wid)
{
    new 
gunname[32];
    switch (
wid)
    {
        case    
.. 17,
                
22 .. 43,
                
46 :        GetWeaponName(wid,gunname,sizeof(gunname));
        case    
0:          format(gunname,32,"%s","Fist");
        case    
18:         format(gunname,32,"%s","Molotov Cocktail");
        case    
44:         format(gunname,32,"%s","Night Vis Goggles");
        case    
45:         format(gunname,32,"%s","Thermal Goggles");
        default:            
format(gunname,32,"%s","Invalid Weapon Id");
    }
    return 
gunname;

Reply


Messages In This Thread
Help - Check weapons a player - by JoshNudock - 06.06.2015, 19:43
Re: Help - Check weapons a player - by Face9000 - 06.06.2015, 21:09

Forum Jump:


Users browsing this thread: 1 Guest(s)