07.10.2012, 19:05
Hey dear,
i have still a little question by using sscanf2:
How can I do it like this?
I try it like this:
But it didnt work, if I type in /shop sell (same with /show own), it shows me the code from /shop buy.
How can I do such a thing with sscanf? Sorry, im really new to sscanf, I allways used strcmp.
Thanks for help.
i have still a little question by using sscanf2:
How can I do it like this?
pawn Код:
if(strcmp(string,"/shop",true) == 0)
{
new x_nr[64];
x_nr = strtok(cmdtext, idx);
if(!strlen(x_nr)) return SendClientMessage(playerid, 0xAA3333AA,"ERROR: /shop [buy/sell/own]");
if(strcmp(x_nr,"buy",true) == 0)
{
//some stuff here
}
else if(strcmp(x_nr,"sell",true) == 0)
{
//some stuff here
}
else if(strcmp(x_nr,"own",true) == 0)
{
//some stuff here
}
return 1;
}
pawn Код:
COMMAND:shop(playerid, params[])
{
new act[7];
if (!sscanf(params, "s", act))
{
if(!sscanf("buy","s",act))
{
//some stuff here
}
else if(!sscanf("sell","s",act))
{
//some stuff here
}
else if(!sscanf("own","s",act))
{
//some stuff here
}
} else SendClientMessage(playerid, 0xAA3333AA,"ERROR: /shop [buy/sell/own]");
return 1;
}
How can I do such a thing with sscanf? Sorry, im really new to sscanf, I allways used strcmp.
Thanks for help.