Multiple entries(?)
#1

I want to create a command which looks a bit like this I guess:
pawn Код:
/test one/two/three/four
I have no clue how to make it "register" if you say one, two, three or four
eg. /test three.
Help please.
Reply
#2

Here you go

Код:
CMD:test(playerid, params[])
{
	if(isnull(params))
	{
		SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /test (1 - 3)");
		return 1;
	}
	if(strcmp(params, "1", true)
	{
                SendClientMessage(playerid, COLOR_RED, "This is /test 1");
	}
	if(strcmp(params, "3", true)
	{
                SendClientMessage(playerid, COLOR_RED, "This is /test 2");
	}
	if(strcmp(params, "4", true)
	{
                SendClientMessage(playerid, COLOR_RED, "This is /test 3");
	}
}
Reply
#3

i dont understand this you dont know how to explain this.
Reply
#4

Quote:
Originally Posted by ryanhawk31
Посмотреть сообщение
Here you go

Код:
CMD:test(playerid, params[])
{
	if(isnull(params))
	{
		SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /test (1 - 3)");
		return 1;
	}
	if(strcmp(params, "1", true)
	{
                SendClientMessage(playerid, COLOR_RED, "This is /test 1");
	}
	if(strcmp(params, "3", true)
	{
                SendClientMessage(playerid, COLOR_RED, "This is /test 2");
	}
	if(strcmp(params, "4", true)
	{
                SendClientMessage(playerid, COLOR_RED, "This is /test 3");
	}
}
This is unfortunately not working.
For the record, I am using sscanf and ZCMD.
Reply
#5

Quote:
Originally Posted by ******
Посмотреть сообщение
Should be "!strcmp" not "strcmp". Also, they used the numeral "1" and you said the word "one" - you might have spotted that already but just pointing it out.
!strcmp, yeah, that fixed it. I noticed that as well, thank you both.

edit: What if I want to add eg. /test one two and check two parameters?
Reply
#6

Could you help me out?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)