Now let's see, this should work.
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,parameter[]="",len = 0,flags[]="", repeat = 0);
Code:
public firstfunction() {
log_amx("First function, gametime: %f", get_gametime())
set_task(0.5, "secondfunction", 0, "", 0, "a", 10)
set_task(5.0, "thirdfunction")
}
public secondfunction() {
log_amx("Second function, gametime: %f", get_gametime())
}
public thirdfunction() {
log_amx("Third function, gametime: %f", get_gametime())
}
This gave the following output:
Quote:
L 09/15/2004 - 08:25:51: [variousstuff.amxx] First function, gametime: 1.000000
L 09/15/2004 - 08:25:52: [variousstuff.amxx] Second function, gametime: 1.800000
L 09/15/2004 - 08:25:52: [variousstuff.amxx] Second function, gametime: 2.050000
L 09/15/2004 - 08:25:52: [variousstuff.amxx] Second function, gametime: 2.596680
L 09/15/2004 - 08:25:53: [variousstuff.amxx] Second function, gametime: 3.034214
L 09/15/2004 - 08:25:53: [variousstuff.amxx] Second function, gametime: 3.581089
L 09/15/2004 - 08:25:54: [variousstuff.amxx] Second function, gametime: 4.019158
L 09/15/2004 - 08:25:54: [variousstuff.amxx] Second function, gametime: 4.565654
L 09/15/2004 - 08:25:55: [variousstuff.amxx] Second function, gametime: 5.003258
L 09/15/2004 - 08:25:55: [variousstuff.amxx] Second function, gametime: 5.550242
L 09/15/2004 - 08:25:56: [variousstuff.amxx] Second function, gametime: 6.096767
L 09/15/2004 - 08:25:56: [variousstuff.amxx] Third function, gametime: 6.096767
|
Well as you can see it does just about what you requested, although it doesn't execute the stuff exactly with 0.5 intervals, but I guess this'd depend on the speed of your system and other factors. At least the function comes in the right order, with the third function right after the last 2nd function as we expected.