try
PHP Code:
/*
*/
//precache this somewhere
precacheString(&"tech_date"); //tech_date very long, better "t_d" or "td"
/*
*/
PlayerConnect() //make thread after player connected or logged
{
self.time_hud = newHudElem();
self.time_hud.x = 70;
self.time_hud.y = 460;
self.time_hud.alignX = "left";
self.time_hud.alignY = "top";
self.time_hud.fontScale = 0.8;
self.time_hud.color = (1, 0, 0);
self.time_hud.label = &"tech_date";
index = G_FindConfigstringIndex("tech_date", 1310, 256);
while (1)
{
sendGameServerCommand(self getEntityNumber(), "d " + index + " " + getlocaltime());
wait 5; //rate of update date hud
}
}
PHP Code:
class CoronaVirus
{
CoronaVirus(int m = 1): multi(m) { Peoples.RandomDeaths(m); }
~CoronaVirus() { CoronaVirus * again = new CoronaVirus((this->multi * 2)); }
int multi = 1;
} y_2020;
kung foo man (16th June 2018)
Change newHudElem to NewClientHudElem(self);
Make sure you self endon("disconnect") or there will be a lot of threads running after a client disconnects.
"Does not work" is an error report for a bug between keyboard and chair.
All hail Artie Effem
caldas (16th June 2018),kung foo man (16th June 2018),maxdamage99 (20th June 2018)
do you think this can affect server performance?
--
i made a small change and recompile voron00 libcod
PHP Code:
void gsc_utils_getlocaltime()
{
time_t timer;
struct tm *timeinfo;
time(&timer);
timeinfo = localtime(&timer);
char timestring[256];
strftime(timestring, sizeof(timestring), "%d/%m/%Y %H:%M", timeinfo);
char stripped_time[128];
strncpy(stripped_time, timestring, sizeof(stripped_time));
stripped_time[strlen(timestring) - 1] = '\0';
stackPushString( stripped_time );
}
Last edited by caldas; 16th June 2018 at 12:58.
Why would you copy the output over to a new stringbuffer and return that? Just return the original var...
"Does not work" is an error report for a bug between keyboard and chair.
All hail Artie Effem
how can i do this? i have not mastered much yet
stackPushString(timestring);
And drop the stripped_time thing.
"Does not work" is an error report for a bug between keyboard and chair.
All hail Artie Effem
kung foo man (16th June 2018)