View Single Post
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-28-2018 , 06:21   Re: set_task not working when server is in pause
Reply With Quote #2

Well, the tasks are checked in the engine pfnStartFrame hook (game frame), so yeah, if the game is paused, this is not going to be executed. Anything related to the server physics will be paused.

If you look at the engine code:
Code:
void SV_Frame(void)
{
	if (!g_psv.active)
	{
		return;
	}

	gGlobalVariables.frametime = host_frametime;
	g_psv.oldtime = g_psv.time;

	SV_CheckCmdTimes();
	SV_ReadPackets();

	if (SV_IsSimulating())
	{
		SV_Physics();
		g_psv.time += host_frametime;
	}

	SV_QueryMovevarsChanged();
	SV_RequestMissingResourcesFromClients();
	SV_CheckTimeouts();
	SV_SendClientMessages();
	SV_CheckMapDifferences();
	SV_GatherStatistics();

	Steam_RunFrame();
}
SV_Physics won't be called if paused (pfnStartFrame/Think/Touch/etc).

The engine doesn't provide a global API function above, but it would be still possible to hook for example SV_ReadPackets with a signature.

That's said, I don't know if it makes sense to do that just for task.
__________________
Arkshine is offline