Raised This Month: $51 Target: $400
 12% 

Remove tasks


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mateo10
Veteran Member
Join Date: Jan 2006
Old 04-27-2007 , 15:15   Remove tasks
Reply With Quote #1

Can you do like this to remove tasks (if the player has like 3 tasks)?
Code:
new players[32], num; get_players(players, num); new player; for(new i=0;i<num;i++) {     player = players[i];     while(task_exists(player))         remove_task(player); }
mateo10 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-27-2007 , 15:24   Re: Remove tasks
Reply With Quote #2

That's why you have to ad a constant number to a task :

set_task(1.0,"task1",1578+id)

set_task(1.0,"task2",2790+id)


Then you can check if each task exists.
ConnorMcLeod is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 04-27-2007 , 20:10   Re: Remove tasks
Reply With Quote #3

If you want all tasks associated with a player to end, you don't have to do as connorr said. You can just use their id in all of them. Then, when you remove_task, it will remove all tasks in that plugin for that id.

However, if you want finer control over each, do as connorr said.
__________________
Brad is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-28-2007 , 03:32   Re: Remove tasks
Reply With Quote #4

So, 2 tasks can have the same id at the same moment without any trouble ?
ConnorMcLeod is offline
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 04-28-2007 , 03:49   Re: Remove tasks
Reply With Quote #5

they can but when u remove it you will remove both at once. I just learned this.
Styles is offline
Send a message via AIM to Styles
mateo10
Veteran Member
Join Date: Jan 2006
Old 04-28-2007 , 04:07   Re: Remove tasks
Reply With Quote #6

So my script does work?
mateo10 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-28-2007 , 07:14   Re: Remove tasks
Reply With Quote #7

If you don't need to remove those tasks separatly, yes.
ConnorMcLeod is offline
FPcokE
Member
Join Date: Aug 2011
Old 03-14-2014 , 07:32   Re: Remove tasks
Reply With Quote #8

Quote:
Originally Posted by ConnorMcLeod View Post
That's why you have to ad a constant number to a task :

set_task(1.0,"task1",1578+id)

set_task(1.0,"task2",2790+id)


Then you can check if each task exists.
If i set the task with the same constant number, will that override the old task or just create another task with the same number?

Anyway, how would you remove only one of those tasks?
And how will you get the id without the constant number?
FPcokE is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 03-14-2014 , 07:37   Re: Remove tasks
Reply With Quote #9

Quote:
Originally Posted by FPcokE View Post
If i set the task with the same constant number, will that override the old task or just create another task with the same number?
Create a new one with the same number

Quote:
Anyway, how would you remove only one of those tasks?
If you only want to remove 1 of the tasks, then each task must have a unique number

Quote:
And how will you get the id without the constant number?
TaskID - Const = ClientID
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).

Last edited by YamiKaitou; 03-14-2014 at 07:37.
YamiKaitou is offline
FPcokE
Member
Join Date: Aug 2011
Old 03-14-2014 , 07:58   Re: Remove tasks
Reply With Quote #10

Quote:
Originally Posted by YamiKaitou View Post
Create a new one with the same number


If you only want to remove 1 of the tasks, then each task must have a unique number


TaskID - Const = ClientID
Thank you for your reply, i did figure it out after a couple of tests though
I must remove the task before creating a new one, in order to avoid multiple tasks with the same command.
FPcokE is offline
Reply



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 13:53.


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