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



sscanf format. - audriuxxx - 28.06.2013

Hi,

1. I want to make with sscanf command, you can input 10 time intervals like: HH:MM, HH:MM ...

But how to get is player wrote right format? not like: qwe, lasds, trt, asdas, sdasd, but hours and minutes: HH:MM .


2.
Код:
new TIMEINTERVALS[ 10 ][ 10 ];
if(sscanf(params, "S[empty]S[empty]S[empty]S[empty]S[empty]S[empty]S[empty]S[empty]S[empty]S[empty]", 
TIMEINTERVALS[ 0 ],TIMEINTERVALS[ 1 ],TIMEINTERVALS[ 2 ],TIMEINTERVALS[ 3 ],TIMEINTERVALS[ 4 ],TIMEINTERVALS[ 5 ],TIMEINTERVALS[ 6 ],
   TIMEINTERVALS[ 7 ],TIMEINTERVALS[ 8 ],TIMEINTERVALS[ 9 ] );
And for player don't need to write exatly 10 intervals.. he can input just 5 HH:MM, HH:MM,HH:MM, HH:MM,HH:MM . Or how much he want, but no more than 10. In my sscanf, i do it right? because if i check TIMEINTERVALS string if it will be empty (with strcmp), then player don't write more intervals right?


Re: sscanf format. - audriuxxx - 28.06.2013

What bad here?

Код:
if(sscanf(params, "dS(empty)[9]S(empty)[9]S(empty)[9]S(empty)[9]S(empty)[9]S(empty)[9]S(empty)[9]S(empty)[9]S(empty)[9]S(empty)[9]
I get empty statement.


Re: sscanf format. - audriuxxx - 28.06.2013

Fixed, just in end where is variables i add ; ..