AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   set_task & sequence question (https://forums.alliedmods.net/showthread.php?t=40937)

SSJ2GOKU 07-06-2006 12:30

set_task & sequence question
 
Hello,

I made a function that requires 2 inputes, the players id and a variable

Code:

public playsound(id, number){
    switch(number){
          case 1:{ emit_sound(id, CHAN_BODY, "sounds/ss/1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM) }
          case 2:{ emit_sound(id, CHAN_BODY, "sounds/ss/2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM) }
    }
}

now i want to call the function up in set_task
is this the right way to call it up?

Code:

public sound_system(id){
    set_task(1.0, "playsound", id, "1")
    set_task(2.0, "playsound", id, "2")
}


v3x 07-06-2006 14:35

Re: set_task question
 
Code:
new param[2]; param[0] = id; param[1] = num; set_task(1.0, "playsound", (id + 12345), param, 2);

Then in your playsound function:
Code:
public playsound(param[2]) {   new id = param[0];   new num = param[1];   // ... }
or something.

SSJ2GOKU 07-07-2006 11:50

Re: set_task question
 
Quote:

Originally Posted by v3x
Code:
new param[2]; param[0] = id; param[1] = num; set_task(1.0, "playsound", (id + 12345), param, 2);

what means the 12345 ?

Zenith77 07-07-2006 15:21

Re: set_task question
 
You need a unique taskid, or else the core will over write your task's data, due to another plugin. So basically its just some random number.

VEN 07-07-2006 15:55

Re: set_task question
 
Not true, it's possible to create numerous tasks with the same ID.
Task ID prefixes is useful for example to operate with the different task groups.

Brad 07-07-2006 17:09

Re: set_task question
 
Quote:

Originally Posted by Zenith77
You need a unique taskid, or else the core will over write your task's data, due to another plugin. So basically its just some random number.

Lies!

Quote:

Originally Posted by VEN
Not true, it's possible to create numerous tasks with the same ID.
Task ID prefixes is useful for example to operate with the different task groups.

Truths!

SSJ2GOKU 07-07-2006 17:38

Re: set_task question
 
erm im getting confused :lol:

btw does anyone know this:
how to make a model's sequence fully run and then reset it back to beginning so it runs again?
like a sequence loop

PLS DO NOT SAY SERVER_FRAME, because that fucks up the sequence

i know these are needed
Code:

entity_set_int(entid[id], EV_INT_sequence, #seqnr)
entity_set_int(entid[id], EV_INT_gaitsequence, 0)


v3x 07-08-2006 04:09

Re: set_task & sequence question
 
client_PreThink

3xr 07-08-2006 04:43

Re: set_task & sequence question
 
Hey, IM me, I think we are on the same path of something similar to ESF.

Aim: x3xRx

SSJ2GOKU 07-08-2006 13:16

Re: set_task & sequence question
 
i'm gonna test it out if it works

btw ty for the help


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

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