Raised This Month: $ Target: $400
 0% 

Show the time before restart


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
biscuit628
Senior Member
Join Date: Jun 2007
Location: 香港HongKong
Old 01-04-2009 , 21:06   Show the time before restart
Reply With Quote #1

First,i am sorry for my poor english

i need some help for the plugins,
it will so the player when will restart
like this 20->19->18->17->16
Game will start in %s sec,seconds
Code:
#include <amxmodx>
 
public restart_time()   
set_task (get_cvar_float("amx_autorestart"),"restart_map",0)   
 
public restart_map() {    
   set_hudmessage(0, 100, 200, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2)     
   show_hudmessage(0,"[AMXX] Automatic Round-Restart!")    
   set_cvar_float("sv_restart",2.0)   
   return PLUGIN_HANDLED
}   
 
public plugin_init() {   
register_plugin("Auto-Restart","1.00","ToT | V!PER")   
register_event("TextMsg","restart_time","a","2&#Game_C")   
register_cvar("amx_autorestart","20.0")
return PLUGIN_CONTINUE     
}

Last edited by biscuit628; 01-05-2009 at 22:38.
biscuit628 is offline
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 01-04-2009 , 22:17   Re: Show the time before restart
Reply With Quote #2

I personally have not done something to this effect, so I cannot provide a code example, but you can tie an entity's think function to a specific time (down to 0.1 seconds) when next to think.

In your case, you would tell it the next think is in 1.0 seconds. You would keep count in a global variable somewhere, and when you get to a certain point, you would not give it a next think time.

Quote:
Originally Posted by Alka View Post
Oh, in this case have a look on this tutorial -> http://forums.alliedmods.net/showthr...highlight=task

All you have to do is to make an ent, hook the Think forward, check for that ent, and set its next_think to 0.1 for best results.
The 0.1 was for a stopwatch, but you get the idea (I hope).
__________________
Bad_Bud is offline
vato loco [GE-S]
Veteran Member
Join Date: Oct 2006
Location: Germany
Old 01-05-2009 , 14:18   Re: Show the time before restart
Reply With Quote #3

hi i'm not sure what you trying to do...
here a example, maybe it is what you try to do !!!
maybe there are better ways to do this...but i'm not a pro scripter
anyway it works
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>

#define PLUGIN "Test"
#define VERSION "1.0"
#define AUTHOR "vato loco [GE-S]"

#define RR_LEVEL ADMIN_KICK

#define TIMER_TASK 123456
#define RESTART_TASK 789123

new g_counter 20
new minute,second

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /restart","timer_tsk",RR_LEVEL)
}

public 
timer_tsk() {
    
client_cmd(0,"spk fvox/warning.wav")
    
set_task(1.0,"time_counter",TIMER_TASK,_,_,"b")
}

public 
time_counter() {
    
g_counter--
    
minute g_counter 3600 60
    second 
g_counter 3600 60
    set_hudmessage
(255,0,0,-1.0,0.35,0,0.01,10.0,0.01,0.01,4)
    
show_hudmessage(0,"[BS] Game will start in ^n %02d:%02d sec",minute,second)
    if(
g_counter == 0) {
        
remove_task(TIMER_TASK)
        
g_counter 20
        
        show_hudmessage
(0,"[Biscuit's Server] Game will start after restart 3 times!")
        
set_task(2.0,"restart",RESTART_TASK,_,_,"a",3)
    }
}

public 
restart() {
    
server_cmd("sv_restartround 1")

__________________

Last edited by vato loco [GE-S]; 01-05-2009 at 14:21.
vato loco [GE-S] is offline
Reply


Thread Tools
Display Modes

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


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