Raised This Month: $ Target: $400
 0% 

remove_task


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 12-27-2005 , 19:35  
Reply With Quote #4

I consider it to be a good idea to always give a random number as a task id, if you plan on manually ending it at some time.

For instance, in my plugins I do something like this:
Code:
#define TASKID_THISACTION  84278346
And then later:
Code:
// if i don't need to know the player's id that set off this task... set_task(timeLength, "myFunction", TASKID_THISACTION);  // or if I do need to know the player's id... set_task(timeLength, "myFunction", TASKID_THISACTION + id);
Finally, I might end the task like:
Code:
// ending the first example of the task I gave... remove_task(TASKID_THISACTION);
I'll leave what I would do in myFunction as an exercise for the reader.

Instead of trying to come up with your own pseduo-random number, I suggest using a site like this that will do it for you.
Brad is offline
 



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:50.


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