AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] set_task And remove_task (https://forums.alliedmods.net/showthread.php?t=168775)

1liornatan 10-03-2011 17:18

[HELP] set_task And remove_task
 
Hey all
So my question is how i can use a taskid with an id
i search the answer but i still dont get it
should i do :
#define task_id 555

and then
set_task(10.0, "example", task_id + id)

and on a public example:
public example(id)

or what?
please help thanks all and sorry for bad english

Bugsy 10-03-2011 20:03

Re: [HELP] set_task And remove_task
 
In example(id), do id -= task_id, leaving you with the id value added to task_id in set_task..its simple math.

new task_id = 555
new id = 10
id + task_id = 565
565 - 555 = 10

Be sure to check if id is still connected before doing anything in the called function, or call remove_task(id+task_id) in client_disconnect().

1liornatan 10-04-2011 01:30

Re: [HELP] set_task And remove_task
 
I still dont get it...
should public Example need to be:
public Example(id)
{
//
}

and can you post me a script that may help please?

[EDIT]:
that what i got:
i making a Example(id)
then id -= task_id
like this:
public example(id)
{
id -= task_id
// continue plugin
}

and using remove_task(id+task_id) where i want it to stop?
if i do how i use it on a value that change his number
like in countdown?

Doc-Holiday 10-04-2011 01:58

Re: [HELP] set_task And remove_task
 
This is how i do mine.
PHP Code:

cosnt TASK_BLEED 12345;

public 
OnPlayerHurt(iVictimiInflictoriAttackerFloat:flDamageiDmgBits)
{
     if(
flDamage >= 60.0)
     {
           
set_task(0.01"Bleed"id+TASK_BLEED);
      }
}

public 
Bleed(Task_Id)
{
     new 
id Task_Id -TASK_BLEED;
     
//Do stuf.



1liornatan 10-04-2011 08:25

Re: [HELP] set_task And remove_task
 
PHP Code:

#define TASK_NUM 555
 
public round_start(id)
{
    
remove_task(id+TASK_NUM)
}
 
public 
player_spawn(id)
{
    
set_task(10.0"example"id+TASK_NUM)
}
 
public 
example(id)
{
    new 
client id -= TASK_NUM
    
// and continue the funcion using client


Does its true?
and how do i use it on a value that changes his number like in count down?
thank you for help


All times are GMT -4. The time now is 19:41.

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