Raised This Month: $ Target: $400
 0% 

set_task parameter


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 12-05-2012 , 13:09   set_task parameter
Reply With Quote #1

I am trying to pass 2 parameters to set_task but i ain't getting anywhere.
I know that the id of the set_task can be taken as a parameter for ex:
PHP Code:
set_task1.0"Function"id );

public Function( 
id ) {
         
// Code here

I have looked at the include files and found this:
PHP Code:
/* Calls function on specified time.
* Flags:
* "a" - repeat.
* "b" - loop task.
* "c" - do task on time after a map timeleft.
* "d" - do task on time before a map timelimit. */
native set_task(Float:time,const function[],id 0,const parameter[]="",len 0,const flags[]=""repeat 0); 
If you look at the parameter, it is constant and a string. I am trying to pass two parameters that are players ids (two of them). Can anyone help me out please?
__________________
n0br41ner is offline
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 12-05-2012 , 13:13   Re: set_task parameter
Reply With Quote #2

PHP Code:
new iArgs];
iArgs] = 7;
iArgs] = 35;

set_task1.0"Function"idiArgssizeofiArgs )); 
__________________
micapat is offline
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 12-05-2012 , 13:16   Re: set_task parameter
Reply With Quote #3

Alright thanks. Just so i get it straight, the function would be:
PHP Code:
public Function( iArgs ) {
        
// code here

Am i wrong?
__________________
n0br41ner is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-05-2012 , 14:06   Re: set_task parameter
Reply With Quote #4

There are 3 headers for tasks callbacks.
When you pass params in the headers, params comes as first argument.
When you pass ONLY the task index, it comes as first argument.

PHP Code:
{
    new 
params[2]
    
params[0] = 1
    params
[1] = 2
    set_task
(1.0"Task_CallBack"53paramssizeod(params))


PHP Code:
public Task_CallBackTASK_INDEX )
{
}

public 
Task_CallBackParams[] )
{
}

public 
Task_CallBackParams[] , TASK_INDEX )
{

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
n0br41ner
Senior Member
Join Date: May 2012
Location: Planet Earth
Old 12-05-2012 , 14:14   Re: set_task parameter
Reply With Quote #5

Oh i see.
Big thanks my friend, really appreciated.
__________________
n0br41ner 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 06:37.


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