Sorry if I wasn't clear enough ^^
What I want to do is the fallowing command:
/selldrugs (playerid) (drugname) (amount) (price)
I was trying like 4 hours to make it on my own but I can add MAX 2 "parameters" or what ever is this I added only "playerid" and "drugname" whenever I tried to add "amount" and "price" command didn't worked and it was whole mess, and now I just fucked up whole command and it's not working.. what have I made:
It's not working it keep saying Invalid player's ID and so on.. it's really messy so I had to ask here what the hell is going on and how can I fix that and add rest 2 things "amount" and "price"
Yeah I know those new command processors are MUCH better and easier to script but seriously I'm scripting for server that is pretty old and oldschool script - strcmp, I know how to script with zcmd+sscanf but I can't mix this with strcmp.. so if you can help me with this I would be really glad
pawn Код:
if(strcmp(cmd, "/selldrugs", true) == 0 || strcmp(cmd, "/sd", true) == 0)
{
new string[256];
new tmp[256];
new giveplayer[MAX_PLAYER_NAME];
new sendername[MAX_PLAYER_NAME];
new gpid = ReturnUser(tmp);
new price;
new needed;
new x_nr[256];
x_nr = strtok(cmdtext, idx);
tmp = strtok(cmdtext, idx);
GetPlayerName(gpid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if(IsPlayerConnected(gpid))
{
if(!strlen(tmp))
{
SendClientMessage(playerid, -1, "{FF6A22}INFO: {FFFFFF}/selldrugs (/sd) [playerid] [drugname] [amount] [price]");
return 1;
}
if(!strlen(x_nr))
{
SendClientMessage(playerid, -1, "{FF6A22}USAGE: {FFFFFF}/selldrugs (/sd) [playerid] [drugname] [amount] [price]");
SendClientMessage(playerid, -1, "{FF6A22}Available names: {FFFFFF}Weed, Cocaine, Crack, Meth, Ectasy, Heroin");
return 1;
}
if(gpid != INVALID_PLAYER_ID)
{
if(ProxDetectorS(8.0, playerid, gpid))
{
if(strcmp(x_nr,"weed",true) == 0)
{
format(string, sizeof(string), "* You offered to sell %d grams of weed to %s for $%d, Wait for a reply.", needed, giveplayer, price);
SendClientMessage(playerid, 0x33CCFFAA, string);
//
format(string, sizeof(string), "* %s wants to sell %d grams of weed to you for $%d, (type /acceptdrugs cocaine) to buy.", sendername, needed, price);
SendClientMessage(gpid, 0x33CCFFAA, string);
}
}
else
{
SendClientMessage(playerid, -1, "{FF6A22}INFO:{FFFFFF} That player isn't enough close");
}
} // invalid player ID
}
else
{
SendClientMessage(playerid, -1, "{FF6A22}INFO:{FFFFFF} Invalid player ID.");
}
return 1;
}
// rest of Commands
return 0;
}