SA-MP Forums Archive
stock printc(const format[], {Float,_}:...) - 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: stock printc(const format[], {Float,_}:...) (/showthread.php?tid=113642)



stock printc(const format[], {Float,_}:...) - cmg4life - 14.12.2009

Код:
stock printc(const format[], {Float,_}:...)
{
  new Hour, Minute, Second;
	gettime(Hour, Minute, Second);
	new cf[100];
	format(cf, 100, format, {Float,_}:...);
	if( fexist(CmdFile) )
	{
	  new File:cmdf=fopen(CmdFile, io_append);
	  fwrite(cmdf, cf);
	  fclose(cmdf);
	}
	return 1;
}
So i made this, ofc it doesn't work, i don't know how to use the format and the Float, should i format it all in a new string or how, could someone explain and re-make my code ? thanks




Re: stock printc(const format[], {Float,_}:...) - yom - 14.12.2009

It's not that simple, and the easiest way is to use a macro.

Your code converted to a macro:
pawn Код:
#define printc(%1); \
{\
  new Hour, Minute, Second;\
  gettime(Hour, Minute, Second);\
  new cf[100];\
  format(cf, 100, %1);\
  if( fexist(CmdFile) )\
  {\
    new File:cmdf=fopen(CmdFile, io_append);\
    fwrite(cmdf, cf);\
    fclose(cmdf);\
  }\
}



Re: stock printc(const format[], {Float,_}:...) - cmg4life - 14.12.2009

Thanks alot Yom...