Search 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)
+--- Thread: Search Command (
/showthread.php?tid=442640)
/Search Command -
FunnyBear - 08.06.2013
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.
is the the grams of drugs.
Thanks
Re: Search Command -
Goldino - 08.06.2013
I don't get it!
Re: Search Command -
FunnyBear - 08.06.2013
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
Re: Search Command -
FunnyBear - 08.06.2013
Please help!
Re: Search Command -
Black Wolf - 08.06.2013
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;
}
Re: Search Command -
FunnyBear - 08.06.2013
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.
Re: Search Command -
Black Wolf - 08.06.2013
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;
}
Re: Search Command -
DeMoX - 08.06.2013
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.