Is there a server-side wait/sleep function?

Is there a function accessible via the server-side code that I can use to wait X amount of milliseconds before executing a command?

I don’t want to issue the command immediately. I also don’t want to use a sleep function that locks the entire server until the command is executed either.

No. You can store a time + delay and then check if current time is later. Look at sv.restartTime.

1 Like

ZTM, thanks.

In server.h, I added:

int statsTime;

Then in sv_init.c inside of of the SV_Init function, I added:

sv.statsTime = sv.time + 600000;

Then in sv_game.c inside of SV_GameSystemCalls() for the G_PRINT switch, I added:

if( sv.statsTime && sv.time >= sv.statsTime ) {
sv.statsTime = sv.time + 600000;
SV_DisplayStats();
}

This is displaying the results of a top 10 statistics function I wrote perfectly, approximately every 10 minutes.