dcmd + sscanf + my hardcore command = problem - 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: dcmd + sscanf + my hardcore command = problem (
/showthread.php?tid=80906)
dcmd + sscanf + my hardcore command = problem -
madmade - 07.06.2009
Hi all,
I got a problem with my super hardcore command. I don't know how to get rest from sscanf.
Here comes the code that will make you understand
I commented the lines that I have problem with.
Код:
dcmd_note(playerid, params[])
{
new typ[64], giveplayer, price;
if (sscanf(params, "usd", giveplayer, typ, price))
{
SendClientMessage(playerid,SZARY,"USAGE: /note [id] [something] [price]");
return 1;
}
if(price < 0)
{
SendClientMessage(playerid,SZARY,"Zbyt niska price.");
return 1;
}
if(!strcmp(typ,"thing",true))
{
SendClientMessage(playerid, COLOR_GRAD2, "Success!");
return 1;
}
if(!strcmp(typ,"onemore",true))
{
new onemorething;
if(sscanf(/*there should be rest from 'params' but i don't know how to do it*/,"d",onemorething))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /note [id] [something] [price] [more]");
return 1;
}
format(string1, sizeof(string1), "Success! One more value is %d!", onemorething);
SendClientMessage(playerid, COLOR_GRAD2, string1);
return 1;
}
if(!strcmp(typ,"twomore",true))
{
new onemorething, secondmorething;
if(sscanf(/*there should be rest from 'params' but i don't know how to do it*/,"dd",onemorething, secondmorething))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /note [id] [something] [price] [more] [more2]");
return 1;
}
format(string1, sizeof(string1), "Success! One more value is %d and second one is %d!", onemorething, secondmorething);
SendClientMessage(playerid, COLOR_GRAD2, string1);
return 1;
} else return 1;
}
Thanks in advance,
madmade
Re: dcmd + sscanf + my hardcore command = problem -
shitbird - 07.06.2009
pawn Код:
if(sscanf(/*there should be rest from 'params' but i don't know how to do it*/,"d",onemorething))
pawn Код:
if (sscanf(params, "d",onemorething))
?? i don't get your question that easily, can you try to explain what the error is? or what is it supposed to do?...
Re: dcmd + sscanf + my hardcore command = problem -
madmade - 07.06.2009
Quote:
Originally Posted by sbґ
pawn Код:
if(sscanf(/*there should be rest from 'params' but i don't know how to do it*/,"d",onemorething))
pawn Код:
if (sscanf(params, "d",onemorething))
?? i don't get your question that easily, can you try to explain what the error is? or what is it supposed to do?...
|
That won't work

.
I want command /note [id] onemore [price] [more]
[id] - from first sscanf
onemore - from first sscanf
[price] - from first sscanf
[more] - from second sscanf that is used later in "if(!strcmp(typ,"onemore",true))"
I want to add one more value to command if
typ will be
onemore
and 2 values if
typ will be
twomore
Re: dcmd + sscanf + my hardcore command = problem -
shitbird - 07.06.2009
Sorry, out of my Regions there, best wait for someone else..

, gl.
Re: dcmd + sscanf + my hardcore command = problem -
Weirdosport - 07.06.2009
Could you try and explain what you want the command to achieve and some examples of its usage?