SA-MP Forums Archive
[HELP] Search drugs command . - 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: [HELP] Search drugs command . (/showthread.php?tid=196335)



[HELP] Search drugs command . - [Aka]Dragonu - 05.12.2010

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;
    }



Re: [HELP] Search drugs command . - SkizzoTrick - 05.12.2010

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]


Re: [HELP] Search drugs command . - [Aka]Dragonu - 05.12.2010

What have you changed ?


Re: [HELP] Search drugs command . - NewYorkRP - 05.12.2010

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

giveplayerid instead of playerid.


Re: [HELP] Search drugs command . - [Aka]Dragonu - 05.12.2010

Oh , ok it worked thank you !