[HELP] Search drugs command .
#1

I made a searchdrugs command for cops but i don't know why if i tipe /searchdrugs [playerid] : ex /searchdrugs 1 it shows my drugs and not the other player drugs . Here is the command :


pawn Код:
if(strcmp(cmd,"/searchdrugs",true)==0)
    {
    format(string, sizeof(string), "Command: %s: %s", sendername2, cmdtext);
    SendCmdMessage(COLOR_YELLOW, string);
    if (PlayerLoggedIn[playerid] != 1)
    {
        SendClientMessage(playerid, COLOR_RED, "Error: You are not logged in");
        return 1;
    }
        if(IsPlayerConnected(playerid))
        {
    if(gTeam[playerid] != TEAM_COP && PlayerInfo[playerid][pRank] == 1 || gTeam[playerid] != TEAM_ARMY && PlayerInfo[playerid][pRank] == 2)
    {
        SendClientMessage(playerid, COLOR_WHITE, "You are not in the cop team!");
        return 1;
         }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GREY, "USAGE: /searchdrugs [playerid]");
                return 1;
            }
            giveplayerid = strval(tmp);
          if(giveplayerid == playerid)
         {
                SendClientMessage(playerid, COLOR_RED, "You are a law officer, you do not have any drugs.");
                return 1;
        }
        if(IsPlayerConnected(playerid))
        {
        if(ProxDetectorS(8.0, playerid, giveplayerid))
        {
        format(string, sizeof(string), "Drugs found : %d grams.", PlayerInfo[playerid][pDrugs]);
        SendClientMessage(playerid, COLOR_RED, string);
         }
        else
        {
       SendClientMessage(playerid, COLOR_GREY, "   You are to far away from that player !");
     return 1;
       }
       }
       }
        return 1;
    }
Reply
#2

pawn Код:
if(strcmp(cmd,"/searchdrugs",true)==0)
    {
    format(string, sizeof(string), "Command: %s: %s", sendername2, cmdtext);
    SendCmdMessage(COLOR_YELLOW, string);
    if (PlayerLoggedIn[playerid] != 1)
    {
        SendClientMessage(playerid, COLOR_RED, "Error: You are not logged in");
        return 1;
    }
        if(IsPlayerConnected(playerid))
        {
    if(gTeam[playerid] != TEAM_COP && PlayerInfo[playerid][pRank] == 1 || gTeam[playerid] != TEAM_ARMY && PlayerInfo[playerid][pRank] == 2)
    {
        SendClientMessage(playerid, COLOR_WHITE, "You are not in the cop team!");
        return 1;
         }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GREY, "USAGE: /searchdrugs [playerid]");
                return 1;
            }
            giveplayerid = strval(tmp);
          if(giveplayerid == playerid)
         {
                SendClientMessage(playerid, COLOR_RED, "You are a law officer, you do not have any drugs.");
                return 1;
        }
        if(IsPlayerConnected(playerid))
        {
        if(ProxDetectorS(8.0, playerid, giveplayerid))
        {
        format(string, sizeof(string), "Drugs found : %d grams.", PlayerInfo[giveplayerid][pDrugs]);
        SendClientMessage(playerid, COLOR_RED, string);
         }
        else
        {
       SendClientMessage(playerid, COLOR_GREY, "   You are to far away from that player !");
     return 1;
       }
       }
       }
        return 1;
    }
PlayerInfo[giveplayerid][pDrugs]
Reply
#3

What have you changed ?
Reply
#4

format(string, sizeof(string), "Drugs found : %d grams.", PlayerInfo[giveplayerid][pDrugs])

giveplayerid instead of playerid.
Reply
#5

Oh , ok it worked thank you !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)