Raised This Month: $ Target: $400
 0% 

set_task function, passing data


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Obbin
Senior Member
Join Date: Mar 2005
Location: 192.168.1.3
Old 09-15-2006 , 09:56   set_task function, passing data
Reply With Quote #1

I want to pass my function called by set_task some additional data
like
myfunc(client_id, entity_id, Float:Origin[3])
and so on, how do I do?
__________________
Sig(h)!
Obbin is offline
Silencer123
Veteran Member
Join Date: Jul 2006
Old 09-15-2006 , 10:12   Re: set_task function, passing data
Reply With Quote #2

As far as I know there is no way to do that - For now try this and hope st_test_b is triggered before st_test_c:
Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "Test set_task" #define VERSION "1.0" #define AUTHOR "Silencer" new something=0 public plugin_init() {     register_plugin(PLUGIN,VERSION,AUTHOR)     register_concmd("st_test","st_test_a",ADMIN_BAN,"- Set_task Test") } public st_test_b(id) {     something=123 } public st_test_c(id,somethingelse) {     client_print(id,print_chat,"Something: %i",something)     something=0 } public st_test_a(id) {     set_task(3.0,"st_test_b",id)     set_task(3.0,"st_test_c",id) }
__________________
EAT YOUR VEGGIES
Silencer123 is offline
MaximusBrood
Veteran Member
Join Date: Sep 2005
Location: The Netherlands
Old 09-15-2006 , 12:13   Re: set_task function, passing data
Reply With Quote #3

Silencer: No.

---

Just use the parameter function of set_task to transport data.
You only need to convert your Float: origin to an int.

Code:
new intOrigin[3]; FVecIVec(myOrigin, intOrigin); set_task(5.0, "myFunc", 0, intOrigin, 3);
__________________
Released six formerly private plugins. Not active here since ages.
MaximusBrood is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 09-15-2006 , 13:34   Re: set_task function, passing data
Reply With Quote #4

Quote:
Originally Posted by Obbin View Post
I want to pass my function called by set_task some additional data
like
myfunc(client_id, entity_id, Float:Origin[3])
and so on, how do I do?
umm, no. u may only have one parameter on the target function.
u can do it like this:

Code:
blabla(id,ent) {     static Float:origin[3], parm[5]     pev(ent,pev_origin, origin)     parm[0] = id     parm[1] = ent     parm[2] = _:origin[0]     parm[3] = _:origin[1]     parm[4] = _:origin[2]     set_task(1.0,"myfunc",0, parm,5) } public myfunc(parms[]) {     static Float:orig[3]     new id = parms[0], ent = parms[1]     orig[0] = Float:parms[2]     orig[1] = Float:parms[3]     orig[2] = Float:parms[4]     ... }
__________________
plop
p3tsin is offline
MaximusBrood
Veteran Member
Join Date: Sep 2005
Location: The Netherlands
Old 09-15-2006 , 14:31   Re: set_task function, passing data
Reply With Quote #5

p3tsin: Thats exactly the same way I described.
__________________
Released six formerly private plugins. Not active here since ages.
MaximusBrood is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 09-15-2006 , 17:19   Re: set_task function, passing data
Reply With Quote #6

ya, i just made it clear & showed how to do it without rounding the float values
__________________
plop
p3tsin is offline
MaximusBrood
Veteran Member
Join Date: Sep 2005
Location: The Netherlands
Old 09-15-2006 , 18:18   Re: set_task function, passing data
Reply With Quote #7

Quote:
Originally Posted by p3tsin View Post
ya, i just made it clear & showed how to do it without rounding the float values
My example isn't rounding the floats...
__________________
Released six formerly private plugins. Not active here since ages.
MaximusBrood is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 09-15-2006 , 18:24   Re: set_task function, passing data
Reply With Quote #8

@ MaximusBrood

It does use floatround to convert it to an int. That how FVecIVec works as you can see it in the stock below.

Code:
/* Changes a float vec to an integer vec */ stock FVecIVec(Float:FVec[3], IVec[3]) {     IVec[0] = floatround(FVec[0])     IVec[1] = floatround(FVec[1])     IVec[2] = floatround(FVec[2])     return 1 }
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
MaximusBrood
Veteran Member
Join Date: Sep 2005
Location: The Netherlands
Old 09-15-2006 , 18:38   Re: set_task function, passing data
Reply With Quote #9

Oh, my bad. I guess I'm just assuming things then without backing up with facts. My apologies.
__________________
Released six formerly private plugins. Not active here since ages.
MaximusBrood is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 09-15-2006 , 19:30   Re: set_task function, passing data
Reply With Quote #10

if you for some reason need to keep them floats, you can just make a global
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
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 12:08.


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