sscanf help - 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: sscanf help (
/showthread.php?tid=642842)
sscanf help -
Kraeror - 08.10.2017
Hello guys, I changed the type of the command creation, using sscanf, but when I'm trying to create sscanf with string, it always says: Usage: ....
Here is my code:
PHP код:
cmd:F(playerid, params[])
{
new result[64];
if(sscanf(params, "s[64]", result))
{
return SendClientMessage(playerid, COLOR_WHITE, "Usage: /F [Text]");
}
return 1;
}
Re: sscanf help -
n00blek - 08.10.2017
Remove those brackets and put return on same line as sscanf(params thing
And move return 1 for 1 tab back
Re: sscanf help -
Kraeror - 08.10.2017
Thanks m8!
+1 REP!
Re: sscanf help -
Twizted - 08.10.2017
Avoid returning SendClientMessage, it's ambiguous and confusing.
pawn Код:
cmd:F(playerid, params[])
{
new result[64];
if(sscanf(params, "s[64]", result))
{
SendClientMessage(playerid, COLOR_WHITE, "Usage: /F [Text]");
return 1;
}
//if the params are correct, then... (add code below)
return 1;
}
Re: sscanf help -
Kraeror - 08.10.2017
Too late Twizted...
n00blek already helped me, I just removed the brackets from sscanf(params and it works perfect now!
Thanks for trying help but next time look my last reply!
Re: sscanf help -
whadez - 08.10.2017
Quote:
Originally Posted by Twizted
Avoid returning SendClientMessage, it's ambiguous and confusing.
pawn Код:
cmd:F(playerid, params[]) { new result[64]; if(sscanf(params, "s[64]", result)) { SendClientMessage(playerid, COLOR_WHITE, "Usage: /F [Text]"); return 1; } //if the params are correct, then... (add code below) return 1; }
|
"Avoid returning SendClientMessage, it's ambiguous and confusing."
It's not ambiguous and confusing. It's actually a pretty cool way to make 2 lines into 1, and if you want to return the opposite value of SendClientMessage, just write ! before it, and it'll return 0;. So just keep it using like that.
Re: sscanf help -
Twizted - 08.10.2017
Quote:
Originally Posted by Kraeror
Too late Twizted...
n00blek already helped me, I just removed the brackets from sscanf(params and it works perfect now!
Thanks for trying help but next time look my last reply!
|
I know he helped you. I was just indicating a best practise (which apparently is subjective).