AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Pass params w/ set_task... (https://forums.alliedmods.net/showthread.php?t=2521)

ThantiK 06-07-2004 15:01

Pass params w/ set_task...
 
I've got a function called
ohh_that_tickles(vIndex)

and I want to do a set task on that function, but I need to set the index of the player its going to be called on. I keep trying to pass the params in the set_task function, but cannot get it to work...

Code:
set_task(0.4,"ohh_that_tickles", 0, vIndex)
[/small]

jtp10181 06-07-2004 15:38

params to set tack have to be passed as an array.

Code:

ohh_that_tickles(vIndex[1])
Code:

new vIndexa[1]
vIndexa[0] = vIndex
set_task(0.4,"ohh_that_tickles", 0, vIndexa)

like that

SidLuke 06-07-2004 17:29

Re: Pass params w/ set_task...
 
jtp10181 is right but try:
Code:
set_task(0.4,"ohh_that_tickles", vIndex) public ohh_that_tickles(id){ //code }

ts2do 06-07-2004 20:20

also if you have many tasks and want to remove one I suggest using something like this for a few
Code:
set_task(0.4,"ohh_that_tickles", vIndex+1234) public ohh_that_tickles(id){ id-=1234 //code }

SidLuke 06-07-2004 20:36

Quote:

Originally Posted by ts2do
also if you have many tasks and want to remove one I suggest using something like this for a few
Code:
set_task(0.4,"ohh_that_tickles", vIndex+1234) public ohh_that_tickles(id){ id-=1234 //code }

or
Code:
#define TICKLES_OFFSET 1234 set_task(0.4,"ohh_that_tickles", vIndex+TICKLES_OFFSET) public ohh_that_tickles(id){ id -= TICKLES_OFFSET //code }
:wink:

ThantiK 06-07-2004 22:29

Thanks guys. Real help.

Any idea what params are passed on DeathMSG?

I know how to do read_data, but could someone point me in a direction?

ts2do 06-07-2004 23:34

1 = killer
2 =victim
3=headshot
4=weapon

ThantiK 06-07-2004 23:40

Nice, thanks a lot.

Not too long until its done and ready for a beta release ;)

and its SO simple! (Sorry for all the Q's...I'm rusty...since AMXX came about, I got divided on coding so I decided to wait until things had settled down again and here we are)

ThantiK 06-07-2004 23:43

Can you pass multiple params?...and how?

[FBX] 06-08-2004 00:24

set_task(float(time), stringfunctionname[], stringarguments[], intnumofarguments)

the difficult part is passing multiple arrays. Lets say you pass two size 40 arrays, then stringarguments should be those two concatinated together with the first starting at stringarguments[0] and the 2nd starting at stringarguments[20]. intnumofarguments would then be 40.


All times are GMT -4. The time now is 14:49.

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