SA-MP Forums Archive
sscanf problem - 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: sscanf problem (/showthread.php?tid=246035)



sscanf problem - Mmartin - 02.04.2011

Hey there, i have little prob. I want 2 make /mute <id/nick> <lenght(optional)> <reason(optional)> command. I have this:
Код:
		sscanf(params,"rI(5)S[50]",ID,time,reason);
i want sth like this:
if is set only ID - mute player for no reason, 5 minuntes.
if is set time, but no reason - mute player for XX Time, with no reason.
if is set reason, but not time - mute player for 5 minutes with reason.
But when i do that, it doesn't work correctly. There are some warnings from console:
Quote:

[21:31:11] sscanf warning: No default value found.
[21:31:11] sscanf warning: Strings without a length are deprecated, please add a destination size.
[21:31:11] sscanf warning: Format specifier does not match parameter count.
[21:29:53] sscanf warning: Unknown format specifier '[', skipping.
[21:29:53] sscanf warning: Unknown format specifier ']', skipping.
[21:24:38] sscanf warning: Unknown format specifier '[', skipping.
[21:24:38] sscanf warning: Unknown format specifier '5', skipping.
[21:24:38] sscanf warning: Unknown format specifier '0', skipping.
[21:24:38] sscanf warning: Unknown format specifier ']', skipping.

etc. Any ideas? :\


Re: sscanf problem - playbox12 - 02.04.2011

pawn Код:
sscanf(params,"rI(5)S(None)[50]",ID,time,reason);
If that doesen't work use;

pawn Код:
sscanf(params,"rI(5)S("None")[50]",ID,time,reason);
I think the first will do, I never worked with optional strings.