Raised This Month: $ Target: $400
 0% 

Please add a countdown for this restart map code


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
GarbageBox
Senior Member
Join Date: Feb 2010
Old 01-09-2011 , 01:28   Re: Please add a countdown for this restart map code
Reply With Quote #5

This is what I edit.
But this code won't stop countdown after restart once.
What's wrong?
Code:
#include <amxmodx>

new countdown
new g_SayText
new roundstart

public plugin_init()
{	
	register_plugin("Auto-Restart", "1.0", "ToT | V!PER")
	register_event("TextMsg", "restart_countdown", "a", "2&#Game_C")
 	register_cvar("amx_autorestart", "10.0")
	g_SayText = get_user_msgid("SayText")
}

public restart_countdown()
{
	set_task(1.0, "start_countdown", _, _, _, "b")
	set_task(get_cvar_float("amx_autorestart"), "restart_round", _)
}

public start_countdown()
{
	countdown++
	new sec = 11 - countdown
	client_printc(0, "\y[AMXX] After %i sec will restart once", sec)
	
	if(countdown == get_cvar_float("amx_autorestart"))
	{
		countdown = 0
		client_printc(0, "\y[AMXX] Game Start")
	}

	return PLUGIN_HANDLED
}

public restart_round()
{	 
	server_cmd("sv_restartround 1")	
	return PLUGIN_HANDLED
}	

stock client_printc(const id, const string[], {Float, Sql, Resul,_}:...) {
	
	new msg[191], players[32], count = 1;
	vformat(msg, sizeof msg - 1, string, 3);
	
	replace_all(msg,190,"\g","^4");
	replace_all(msg,190,"\y","^1");
	replace_all(msg,190,"\t","^3");
	
	if(id)
		players[0] = id;
	else
		get_players(players,count,"ch");
	
	new index;
	for (new i = 0 ; i < count ; i++)
	{
		index = players[i];
		message_begin(MSG_ONE_UNRELIABLE, g_SayText,_, index);
		write_byte(index);
		write_string(msg);
		message_end();  
	}  
}
__________________
You can be a SUPER coder but you Haven't to say such as "stupid, etc." words to the others
GarbageBox 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 02:08.


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