Return sscanf - 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: Return sscanf (
/showthread.php?tid=145497)
Return sscanf -
MummyKillerSLO - 02.05.2010
Hello!
Код:
command(test,playerid,params[])
{
new String1[64], String2[64];
if(!sscanf(params,"ss",String1,String2))
{
SendClientMessageToAll(COLOR_RED,String1);
SendClientMessageToAll(COLOR_WHITE,String2);
}
else
{
SendClientMessage(playerid,COLOR_RED,"Usage: /test Word1 Word2");
}
return 1;
}
This is my code. If I write '/test' it will return how to use it. If I write '/test bla bla' it will show them to all players. But if I write '/test bla' it will also return how to use it. The question is, how can I make, that when you write '/test bla' it will return that just one word is missing like 'Usage: /test bla Word2'?
Sorry for my English...
Re: Return sscanf -
M4S7ERMIND - 02.05.2010
pawn Код:
sscanf(params, "ss ", String1, String2);
if(!strlen(String1[0])) return SendClientMessage(playerid, COLOR_RED, "Usage: /test (Word1) (Word2)");
if(!strlen(String2[0])) return SendClientMessage(playerid, COLOR_RED, "Usage: /test Word1 (Word2)");
or:
pawn Код:
if(sscanf(params, "s ", String1)) return SendClientMessage(playerid, COLOR_RED, "Usage: /test (Word1) (Word2)");
if(sscanf(params[strlen(String1)], "s ", String2)) return SendClientMessage(playerid, COLOR_RED, "Usage: /test Word1 (Word2)");