AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   set_task parameters (https://forums.alliedmods.net/showthread.php?t=173214)

Excalibur.007 12-02-2011 09:25

set_task parameters
 
Is this the correct way of doing this? This is my first time using the parameters in set_task. Searched for help but none of them has help out. Correct my codes. Thanks in advance.

PHP Code:

#define TASK_ONE    574397

public function1(victimattacker)
{
    new 
args[1]
    
    
args[0] = attacker
    
    set_task
(10.0"function2"player+TASK_ONEargs1)
}

public 
function2(taskidargs[])
{
    static 
player
    player 
= (taskid TASK_ONE)
    
    new 
attacker args[0]


or this

PHP Code:

#define TASK_ONE    574397

public function1(victimattacker)
{
    new 
args[2]
    
    
args[0] = victim
    args
[1] = attacker
    
    set_task
(10.0"function2"TASK_ONEargs2)
}

public 
function2(args[])
{
    new 
victim args[0]
    new 
attacker args[1]


Most likely the 2nd one works but I want to use remove_task on ONLY ONE player.

fysiks 12-03-2011 00:41

Re: set_task parameters
 
The first one but I think you need to swap the taskid and args[] in the function2 definition.

Excalibur.007 12-03-2011 03:26

Re: set_task parameters
 
Thanks, I'll try it out.

ConnorMcLeod 12-03-2011 09:07

Re: set_task parameters
 
Both ways are correct.

nikhilgupta345 12-03-2011 10:08

Re: set_task parameters
 
Quote:

Originally Posted by ConnorMcLeod (Post 1606884)
Both ways are correct.

For the first one don't they have to be switched in the function head like fysiks said?

ConnorMcLeod 12-03-2011 12:23

Re: set_task parameters
 
Sure.

fysiks 12-03-2011 18:25

Re: set_task parameters
 
Quote:

Originally Posted by ConnorMcLeod (Post 1606884)
Both ways are correct.

Yes but he want's player specific tasks so only the first one will work for that.

ConnorMcLeod 12-03-2011 18:35

Re: set_task parameters
 
I hadn't see that he wants to be able to remove it, then you are right.


All times are GMT -4. The time now is 08:28.

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