multiple command - 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 command (
/showthread.php?tid=565100)
multiple command -
DzDanieL - 25.02.2015
Hello, i want to do multiple command,
/clan war [invite/deny/accept]
please help, sorry for my bad english
Re: multiple command -
Golf - 25.02.2015
hello, you can use zcmd,sscanf
PHP код:
CMD:clan(playerid, params[])
{
new param[20];
if (sscanf(params, "s[20]", param))
{
SendClientMessage(playerid, 0xFFFFFFF,"[S] : /clan [type]");
SendClientMessage(playerid, 0xFFFFFFF,"[TYPES] [invite/deny/accept]");
return 1;
}
if (!strcmp(param, "invite", true, 6))
{
//code here
}
if (!strcmp(param, "deny", true, 4))
{
//code here
}
if (!strcmp(param, "accept", true, 6))
{
//code here
}
return 1;
}
Re: multiple command -
DzDanieL - 25.02.2015
yes i use zcmd & sscanf but i want to do /clan WAR [invite/deny/accept] not /clan [invite/deny/accept] or /clanwar [invite/deny/accept]
Re: multiple command -
-=Dar[K]Lord=- - 25.02.2015
You can do that by using strings in sscanf
Ex.
Код:
sscanf(params,"s[128]",invitationtype))
And then use strcmp for comparing if string matches any one of case or you can use numbers for that
Re: multiple command -
CalvinC - 25.02.2015
Then add a second parameter, also no need for param to be a size of 20.
pawn Код:
new param[6], option[6];
if(sscanf(params, "s[6]s[6]", param, option))