dcmd + sscanf + my hardcore command = problem
#1

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
Reply
#2

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?...
Reply
#3

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
Reply
#4

Sorry, out of my Regions there, best wait for someone else.. , gl.
Reply
#5

Could you try and explain what you want the command to achieve and some examples of its usage?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)