AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Resolved] Remove task for only certain user? (https://forums.alliedmods.net/showthread.php?t=47920)

hlstriker 11-29-2006 23:06

[Resolved] Remove task for only certain user?
 
Hi, I have a task set on repeat forever. Now I want to remove the task for only the certain player. How can I do this?

The Specialist 11-29-2006 23:11

Re: Remove task for only certain user?
 
are you using set_task ?

Code:
if(get_user_index()== my_player) {            remove_task("whatever") }

You wernt very explanatory . Do you want it done on a player from a cliient command or by his name or auth_id ? So check to make suer its the player you want then use remove_task()
Code:

remove_task
Core (amxmodx.inc)
Description
remove_task - Removes all tasks with given id.
Syntax
remove_task ( id = 0, outside = 0 )
Type
Native
Notes
If outside var is set then a task can be removed also when was set in another plugin.var fe = FindFrame("toc", top);if ((fe != null) && (chmtop.c2wtopf.jstree != null)) {  if (chmtop.c2wtopf.FITEMS[chmtop.c2wtopf.pagenum] != chmtop.c2wtopf.pageid)    chmtop.c2wtopf.jstree.OpenTreeNode("source/" + chmtop.c2wtopf.pageid);}

:wink:

hlstriker 11-29-2006 23:23

Re: Remove task for only certain user?
 
The explanation the website gives confused me. So would using...
Code:
remove_task(id)
remove all tasks from that certain id?

Here is the task that I set...
Code:
set_task(1.0, "timerCount", id, "", 0, "b");

Zenith77 11-29-2006 23:48

Re: Remove task for only certain user?
 
It's not talking about the players id, it's talking about the tasks id. Everytime you create a task, you assign a special id (the id parameter) to it in order to keep track of it and/or modify it as in this case.

hlstriker 11-29-2006 23:51

Re: Remove task for only certain user?
 
In...
Code:
set_task(1.0, "timerCount", id, "", 0, "b");

What part is the special id? The site says where I put "id" at in that task is where you transfer variables?

jim_yang 11-29-2006 23:57

Re: Remove task for only certain user?
 
set_task(1.0, "timerCount", 12345, "",0,"b");

Zenith77 11-29-2006 23:59

Re: Remove task for only certain user?
 
Quote:

Originally Posted by Funcwiki
set_task - Calls function on specified time.

Syntax:
set_task ( Float:time, const function[], id = 0, parameter[]="", len = 0, flags[]="", repeat = 0 )
Type:
Native
Notes:
The parameters break down as such:

* Float:time - Interval of timer in second. (minimum 0.1 seconds)
* function[] - A string that contains the public function to run on the timer.
* id - A unique id to assign to the task.
* parameter - An array contain data to send to the timer function.
* len - Size of the array to send to the timer function.
* flags - One of the following:
-- "a" - Repeat task a specified number of times
-- "b" - Loop task infinitely
-- "c" - do task on time after a map timeleft
-- "d" - do task on time before a map timeleft
* repeat - If flags is "a", specifies the number of times to repeat the task.


hlstriker 11-30-2006 00:10

Re: Remove task for only certain user?
 
Thanks everyone for clearing that up, I was really confused :P


All times are GMT -4. The time now is 06:54.

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