Raised This Month: $32 Target: $400
 8% 

Solved How to set tasks


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Beqa Gurgenidze
BANNED
Join Date: Nov 2016
Old 08-22-2017 , 06:17   How to set tasks
Reply With Quote #1

Can Anyone help me. How to set tasks in amxx module coding. (or without amxx, im using only metamod)

Last edited by Beqa Gurgenidze; 08-24-2017 at 11:17.
Beqa Gurgenidze is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 08-22-2017 , 07:59   Re: How to set tasks
Reply With Quote #2

Every frame check if the time has come to execute your desired function.
klippy is offline
Beqa Gurgenidze
BANNED
Join Date: Nov 2016
Old 08-22-2017 , 10:17   Re: How to set tasks
Reply With Quote #3

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:
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:
g_pFunctionTable->pfnSpawn = OnSpawn;
g_pFunctionTable->pfnStartFrame = OnStartFrame;
4. And add those forwards. (before ^ this forward).

Code:
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.
Attached Files
File Type: zip Task.zip (80.2 KB, 104 views)

Last edited by Beqa Gurgenidze; 08-22-2017 at 10:33. Reason: Additional info
Beqa Gurgenidze is offline
killerZM
Senior Member
Join Date: Sep 2016
Old 08-23-2017 , 15:08   Re: How to set tasks
Reply With Quote #4

beqa can u explain more bro ?
killerZM is offline
Beqa Gurgenidze
BANNED
Join Date: Nov 2016
Old 08-24-2017 , 02:40   Re: How to set tasks
Reply With Quote #5

Quote:
Originally Posted by killerZM View Post
beqa can u explain more bro ?
Don't know how to explain more. if you have problems & want help contact me on steam.
Beqa Gurgenidze is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:21.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode