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

Some questions about set_task()


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Misery
Senior Member
Join Date: Dec 2010
Old 01-01-2012 , 09:53   Some questions about set_task()
Reply With Quote #1

Hi,

I have a few question on this function...

1- How to pass arrays/string parameters to the function called with set_task()? I know its possible to use ints, what about arrays? Is the only way possible is to use global vars?

2- It seems read_argv() does not work in set_task()? Is there a way to defer read_argv()'s source in set_task() to point to the global arguments (the one used with the command)?

Thanks!

Misery

Last edited by Misery; 01-01-2012 at 09:54.
Misery is offline
keyblade
Member
Join Date: Nov 2010
Location: China
Old 01-01-2012 , 10:12   Re: Some questions about set_task()
Reply With Quote #2

1.
PHP Code:
//int
new array[32]
...
set_task(0.1"Func"TASKID, array, 32)
...
public 
Func(array[], taskid)
...
 
//float
new Float:array[32]
set_task(0.1"Func"TASKID_:array, 32)
...
public 
Func(Float:array[], taskid)
... 
2.
you mean use read_argv() in Func(like the example above)?
i think it's not nessary.just check the parameters passed by
keyblade is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-01-2012 , 13:25   Re: Some questions about set_task()
Reply With Quote #3

read_argX only works when a command forward is sent such as in client_command forward or in an register_XXcmd callback, it can't work in a task callback.
Use the array to pass arguments you want.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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:55.


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