29.01.2018, 13:31
I'm thinking of making my log timestamps global. As in...
Currently every command has its own gettime and getdate.
I'm thinking of creating a 500ms timer that gets the time and date on global variables so I don't have to add the same ugly code everywhere...
Is this bad practice? How do YOU do this? Any chance this might be any more inaccurate than it currently is? The only thing I can think of is the timer dying, then my logs would be pretty messed up.
Currently every command has its own gettime and getdate.
Код:
if(strcmp(cmd, "/samp", true) == 0) { SendClientMessage(playerid, COLOR_WHITE, "SA:MP."); new y, m, d;new h,mi,s;getdate(y,m,d);gettime(h,mi,s); format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] SA:MP -> %s.",d,m,y,h,mi,s,sendername); CommandLog(string); }
Код:
new y, m, d;new h,mi,s; SetTimer("timetimer", 500, 1); public timetimer() { getdate(y,m,d);gettime(h,mi,s); }