Page 1 of 1

How to set tasks

Posted: Tue Oct 20, 2026 7:21 am
by Archive-Poster
I've Edited CTask from source code. Heres files if anyone is going to make tasks in module. (Works without amxmodx).
working to me.

[for those who is going to add this extension]

1. Write This In Main Code:

Code: Select all

CTaskMngr TaskManager;
extern DLL_FUNCTIONS *g_pFunctionTable;
static float TimeLimit;
static float TimeLeft = 0.0f;
2. Hook load forward. i've edited GetEngineFunctions_Post Function and added there forward that will be called.
3. After Creating Forward, Add there this code:

Code: Select all

g_pFunctionTable->pfnSpawn = OnSpawn;
g_pFunctionTable->pfnStartFrame = OnStartFrame;
4. And add those forwards. (before ^ this forward).

Code: Select all

int OnSpawn(edict_t *P1)
{
	TimeLimit = CVAR_GET_FLOAT("mp_timelimit");
	TaskManager.registerTimers(&gpGlobals->time, &TimeLimit, &TimeLeft);
	g_pFunctionTable->pfnSpawn = NULL;
	return NULL;
}

void OnStartFrame(void)
{
	TaskManager.startFrame();
}
Now you can call task whenever you want.
Flag:
1 = Repeat Task With Specified Times.
2 = Loop Infinitely.