Raised This Month: $51 Target: $400
 12% 

1337 Restarter


Post New Thread Reply   
 
Thread Tools Display Modes
watch
Senior Member
Join Date: Sep 2005
Old 11-30-2006 , 08:30   Re: Server Restart (every hour)
Reply With Quote #11

This plugin seems to cover this :O http://forums.alliedmods.net/showthr...light=schedule

Also whats the point in the else statement and having parameters on the task :E? and would you not have to exec the server.cfg before server_cmd("restart")?

I can't remember exactly what the "restart" command does, I seem to remember it just being similar to "exit" and you would still need something to autorestart your server?
__________________
Code:
#include <amusing_small_signiture>
watch is offline
mateo10
Veteran Member
Join Date: Jan 2006
Old 11-30-2006 , 11:04   Re: Server Restart (every hour)
Reply With Quote #12

How do you make a countdown in a HUD message?
mateo10 is offline
mateo10
Veteran Member
Join Date: Jan 2006
Old 12-01-2006 , 10:04   Re: Server Restart (every hour) [New Update v2.0]
Reply With Quote #13

New Update:
v 2.0
-Added HUD Message countdown (Credits to jim_yang, The Specialist and Brad)
-Added cvar for HUD Message countdown
-Improved the code a little bit ;)
-Deleted the cvar to change the restart time
mateo10 is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 12-01-2006 , 10:46   Re: Server Restart (every hour) [New Update v2.0]
Reply With Quote #14

CountDown(id)
restartServer(id)
id has no usage.
so get rid of it.

and g_counter is not count down, it increases every second.
so you should check if(g_counter==3600) then reset it to 0.
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
mateo10
Veteran Member
Join Date: Jan 2006
Old 12-01-2006 , 11:01   Re: Server Restart (every hour) [New Update v2.0]
Reply With Quote #15

Can I still use
Code:
if(hour == 0 && minute == 0 && second == 0) {     restartServer() }
or shall I change that to
Code:
if(g_counter==3600) {     g_counter = 0 }

AND...
I have to use id on both CountDown and serverRestart because
of the client_print command.

Last edited by mateo10; 12-01-2006 at 11:05.
mateo10 is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 12-01-2006 , 11:05   Re: Server Restart (every hour) [New Update v2.0]
Reply With Quote #16

you dont need to check hour,minute,second, just check g_counter
if count down then g_counter = 3600, g_counter--
check g_counter==0 ? restartserver;reset g_conter to 3600 : donothing

if count then g_counter = 0, g_counter++
same trick you can do it yourselft. good luck
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
mateo10
Veteran Member
Join Date: Jan 2006
Old 12-01-2006 , 11:09   Re: Server Restart (every hour) [New Update v2.0]
Reply With Quote #17

Ahaaa... now I get it
Thank you very much for your help. I appreciate it.

So the hour = g_counter / 3600 is wrong??

Last edited by mateo10; 12-01-2006 at 11:12.
mateo10 is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 12-01-2006 , 11:17   Re: Server Restart (every hour) [New Update v2.0]
Reply With Quote #18

it is not wrong, just not necessary.
g_counter is to count the second.
so g_counter==0 then certainly hour==minute==second==0
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
jim_yang
Veteran Member
Join Date: Aug 2006
Old 12-01-2006 , 11:53   Re: Server Restart (every hour) [New Update v2.1]
Reply With Quote #19

Code:
#include <amxmodx> #include <amxmisc> #define TIMER_TASK 123456 new g_Switch, g_ShowTimer new g_counter = 3600 new hour, minute, second public plugin_init() {         register_plugin("Server Restart","2.1","MaTTe (mateo10)")         g_Switch = register_cvar("server_restart", "1")         g_ShowTimer = register_cvar("server_showtimer", "1")                 set_task(1.0, "CountDown", TIMER_TASK, _, _, "b")         return PLUGIN_CONTINUE } public CountDown() {         if(g_counter==0)         {                 restartServer()                 return         }         g_counter--         if(!get_pcvar_num(g_ShowTimer))                 return         hour = g_counter / 3600         minute = g_counter % 3600 / 60         second = g_counter % 3600 % 60         set_hudmessage(0, 100, 0, -1.0, 0.35, 0, 0.01, 1.0, 0.01, 0.01, 4)         //show_hudmessage(0, "%d Seconds Until Server Restart.", g_counter)         show_hudmessage(0,"%02d:%02d:%02d Left",hour,minute,second) } public restartServer() {         if(get_pcvar_num(g_Switch)==1)         {                 server_cmd("exec server.cfg")                 server_cmd("restart")         }         return PLUGIN_CONTINUE }


hope you like this
__________________
Project : CSDM all in one - 99%
<team balancer#no round end#entity remover#quake sounds#fake full#maps management menu#players punishment menu#no team flash#colored flashbang#grenade trails#HE effect#spawn protection#weapon arena#weapon upgrade#auto join#no weapon drop#one name>
jim_yang is offline
mateo10
Veteran Member
Join Date: Jan 2006
Old 12-01-2006 , 11:57   Re: Server Restart (every hour) [New Update v2.1]
Reply With Quote #20

Thank you very much jim! You've been soooo helpful to me.
I'm gonna credit you as hell.

Again thank you very much!
mateo10 is offline
Reply



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 23:51.


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