Search Command
#1

Hi,

I have recently made a drug system, but I'm working on the search command which I don't really get. I have the drugs variable,

pawn Код:
new
    g_pDrugs[ MAX_PLAYERS ];
The search command allows a Law Enforcement Officer to search a person, and if they have drugs, it will say how much drugs they have.

pawn Код:
g_pDrugs[ MAX_PLAYERS ];
is the the grams of drugs.

Thanks
Reply
#2

I don't get it!
Reply
#3

Quote:
Originally Posted by Goldino
Посмотреть сообщение
I don't get it!
I just need a help on the search command which allows cops to check if the person has drugs.

Please help!

P.S ~ I use ZCMD
Reply
#4

Please help!
Reply
#5

pawn Код:
CMD:check(playerid, params[])
{
          new pID;
         if(sscanf(params, "u", pID)) return SendClientMessage(playerid, -1, "Correct Syntax: /Check PlayerName|ID.");
         if(g_pDrugs[pID] > 0)  
             SendClientMessage(playerid, -1, "Player has drugs!");
        else
             SendClientMessage(playerid, -1, "Player dont have drugs!");
        return 1;
}
Reply
#6

Quote:
Originally Posted by Black Wolf
Посмотреть сообщение
pawn Код:
CMD:check(playerid, params[])
{
          new pID;
         if(sscanf(params, "u", pID)) return SendClientMessage(playerid, -1, "Correct Syntax: /Check PlayerName|ID.");
         if(g_pDrugs[pID] > 0)  
             SendClientMessage(playerid, -1, "Player has drugs!");
        else
             SendClientMessage(playerid, -1, "Player dont have drugs!");
        return 1;
}
I want to check how much drugs the player has, and send the message to the cop saying the player has %s amount of drugs.
Reply
#7

pawn Код:
CMD:check(playerid, params[])
{
          new pID, str[80];
         if(sscanf(params, "u", pID)) return SendClientMessage(playerid, -1, "Correct Syntax: /Check PlayerName|ID.");
         if(g_pDrugs[pID] > 0)  {
             format(str, sizeof(str), "The Player has %d amount of drugs", g_pDrugs[pID]);
             SendClientMessage(playerid, -1, str);
        }   else   {
             SendClientMessage(playerid, -1, "Player dont have drugs!"); }
        return 1;
}
Reply
#8

You must use this
--When a player buy drugs:
Код:
g_pDrugs[playerid] ++;
This code add +1, i don't know how many drugs players buy, but that's +1.

so if they buy 2 drugs add that code twice...etc

+Command processor doesn't change anything on commands effect.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)