Multiple entries(?) - 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)
+--- Thread: Multiple entries(?) (
/showthread.php?tid=431702)
Multiple entries(?) -
BigGroter - 19.04.2013
I want to create a command which looks a bit like this I guess:
I have no clue how to make it "register" if you say one, two, three or four
eg. /test three.
Help please.
Re: Multiple entries(?) -
ryanhawk31 - 19.04.2013
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");
}
}
Re: Multiple entries(?) -
z3r0w1zard - 19.04.2013
i dont understand this you dont know how to explain this.
Re: Multiple entries(?) -
BigGroter - 19.04.2013
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.
Re: Multiple entries(?) -
BigGroter - 19.04.2013
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?
Re: Multiple entries(?) -
BigGroter - 19.04.2013
Could you help me out?