Raised This Month: $ Target: $400
 0% 

Can't get a set_task to repeat/loop


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 09-15-2004 , 02:28  
Reply With Quote #6

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.
Johnny got his gun is offline
 



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 17:18.


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