Raised This Month: $ Target: $400
 0% 

Loop delay help (sv_restart for x seconds)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
hunter_stth
Junior Member
Join Date: Apr 2009
Location: Serbia
Old 06-28-2009 , 08:58   Loop delay help (sv_restart for x seconds)
Reply With Quote #1

How to make loop delay in this code?
I want to run this loop in a 1 second delay.

Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Restart and live!"
#define VERSION "1.0"
#define AUTHOR "HunTeR"

new roundcount = 0
new i = 60
public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)    
    register_logevent("RoundEnd", 2, "1=Round_End")
    register_logevent("RoundStart", 2, "1=Round_Start")
}
public RoundEnd() {
    if(roundcount == 0) {
     server_cmd("sv_restart 1")
     roundcount++
    }
}
public RoundStart() {
    if(roundcount == 0) {
		for(i=60;i>=0;i--) {
			if(i == 1) {
				set_hudmessage(0, 255, 0, -1.0, -1.0, 0, 6.0, 12.0)
				show_hudmessage(0, "Live for 1 second!")
				console_print(0, "Live for 1 second!")
			}
			else {
				set_hudmessage(0, 255, 0, -1.0, -1.0, 0, 6.0, 12.0)
				show_hudmessage(0, "Live for %d seconds!",i)
				console_print(0, "Live for %d seconds!",i)
			}

		
		}
    }
	else if(roundcount == 1) {
        set_hudmessage(0, 255, 0, -1.0, -1.0, 0, 6.0, 12.0)
        show_hudmessage(0, "Game is now Live!!!")
	}
}
Sorry for my bad english!

Last edited by hunter_stth; 06-28-2009 at 10:15.
hunter_stth 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 15:28.


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