Command isn't working
#1

Hello this is my command, but when ever I write /frisk (playerid) it says "You are not cop!" even if I have cop skin...
Also 1 warning:
pawn Код:
warning 219: local variable "x" shadows a variable at a preceding level
how to fix it?

pawn Код:
if(strcmp(cmd, "/frisk", true) == 0)
    {
        if(!IsPlayerCop(playerid))
        {
            if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_LIGHTGREEN, "Usage: /frisk [PlayerID]");
            tmp = strtok(cmdtext, idx);
            new otherplayer = strval(tmp); // giveplayerid
            new Count, x; // warning line
            new string[128], string2[64];
            new WeapName[24], slot, weap, ammo;
           
            if(IsPlayerConnected(otherplayer) && otherplayer != INVALID_PLAYER_ID)
            {
                format(string2,sizeof(string2),"_______|- %s's Weapons -|_______", otherplayer);
                SendClientMessage(playerid,COLOR_LIGHTGREEN,string2);
                for(slot = 0; slot < 14; slot++)
                {
                GetPlayerWeaponData(otherplayer, slot, weap, ammo);
                if( ammo != 0 && weap != 0)
                Count++;
                }
                if(Count < 1)
                return SendClientMessage(playerid,COLOR_LIGHTGREEN,"No Weapons found!");
                if(Count >= 1)
                {
                    for (slot = 0; slot < 14; slot++)
                    {
                    GetPlayerWeaponData(otherplayer, slot, weap, ammo);
                    if( ammo != 0 && weap != 0)
                    {
                    GetWeaponName(weap, WeapName, sizeof(WeapName));
                    if(ammo == 65535 || ammo == 1)
                    format(string,sizeof(string),"%s%s (1)",string, WeapName);
                    else format(string,sizeof(string),"%s%s (%d)",string, WeapName, ammo);
                    x++;
                    if(x >= 5)
                    {
                    SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
                    x = 0;
                    format(string, sizeof(string), "");
                    }
                    else format(string, sizeof(string), "%s,  ", string);
                    }
                    }
                    if(x <= 4 && x > 0)
                    {
                    string[strlen(string)-3] = '.';
                    SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
                    }
                }
                return 1;
            }
            else return SendClientMessage(playerid,COLOR_LIGHTGREEN,"Invalid player ID");
        }
        else return SendClientMessage(playerid,COLOR_LIGHTGREEN,"You are not cop!");
    }
    return 0;
}
Reply


Messages In This Thread
Command isn't working - by Lajko1 - 28.10.2013, 15:28
Re: Command isn't working - by Reera - 28.10.2013, 15:36
Re: Command isn't working - by Patrick - 28.10.2013, 15:58
Re: Command isn't working - by Lajko1 - 28.10.2013, 16:40
Re: Command isn't working - by Patrick - 28.10.2013, 16:46
Re: Command isn't working - by Lajko1 - 28.10.2013, 16:52
Re: Command isn't working - by Lajko1 - 28.10.2013, 22:01
Re: Command isn't working - by Lajko1 - 29.10.2013, 11:47
Re: Command isn't working - by PrivatioBoni - 29.10.2013, 11:50
Re: Command isn't working - by Lajko1 - 29.10.2013, 12:57

Forum Jump:


Users browsing this thread: 5 Guest(s)