Raised This Month: $32 Target: $400
 8% 

Daily Restart


Post New Thread Reply   
 
Thread Tools Display Modes
mercury
Member
Join Date: Jun 2004
Old 08-09-2006 , 18:40   Re: Daily Restart
Reply With Quote #21

Vm|Mayhem, can u post/attach it here, plz?
__________________
mercury is offline
Vm|Mayhem
Senior Member
Join Date: Feb 2005
Location: Murrieta, CA.
Old 08-10-2006 , 00:10   Re: Daily Restart
Reply With Quote #22

Code:
/*********** 

Daily Restart

Description:
- Automatically attempts to restart your server daily when its empty (works correctly with bots/hltv), 
  as servers often don't get restarted unless they crash or start to perform badly.
- Assuming you are using something to restart your server when its shutdown, like serverdoc it will work correctly 
  (most gsp's will have scripts automatically restart servers when hlds crashes anyway)
- It won't function with mapvotes, only regular map changelevels (i.e when the timelimit runs out), 

How to install:
- Find your plugins.ini in your config folder (addons/amxmodx/configs/plugins.ini) open it in notepad and type restart.amxx
- Compile the restart.sma and place the restart.amxx in your plugins folder (addons/amxmodx/plugins/)

Required Modules:
- None

watch <:D~?

***********/

#include <amxmodx>

public plugin_init() {
	register_plugin("restart","1.0","watch")
	register_event("30","changeMap","a")
}

public changeMap() {

	new currentdate[12], lastrestarted[12]

	get_time("%d/%m/%Y",currentdate,11)

	if (!vaultdata_exists("lastrestarted")) 
		set_vaultdata("lastrestarted",currentdate)

	get_vaultdata("lastrestarted",lastrestarted,11)

	if (!equali(currentdate,lastrestarted)) {

		new i,playercount,botcount
		playercount = get_playersnum()

		for(i=1;i<=get_maxplayers();i++)
			if(is_user_bot(i) || is_user_hltv(i))
				botcount++
			
		if (playercount == botcount) {
			set_vaultdata("lastrestarted",currentdate)
			log_amx("Restarting: (Last Restart: %s) (Clients: %d) (Bots: %d)",lastrestarted, playercount-botcount, botcount)
			server_cmd("exit") 
			return PLUGIN_HANDLED
		}
	}
	return PLUGIN_CONTINUE
}

This version just uses the last time restarted value in your /data/vault.ini file. Once the server is empty and reaches that date, it will restart. Simple, but it works, I've been using it since he first released it.
Vm|Mayhem is offline
Send a message via AIM to Vm|Mayhem
watch
Senior Member
Join Date: Sep 2005
Old 08-14-2006 , 18:21   Re: Daily Restart
Reply With Quote #23

eep, i did some testing and for some reason tickcount() was returning negative values :s

updated first post with original plugin with a few changes, let me know if theres any problems

http://forums.alliedmods.net/showpos...32&postcount=1
__________________
Code:
#include <amusing_small_signiture>
watch is offline
Vm|Mayhem
Senior Member
Join Date: Feb 2005
Location: Murrieta, CA.
Old 08-15-2006 , 22:14   Re: Daily Restart
Reply With Quote #24

Verson 1.2 works fine.
Vm|Mayhem is offline
Send a message via AIM to Vm|Mayhem
edwa_03
New Member
Join Date: Feb 2008
Old 02-17-2008 , 14:45   Re: Daily Restart
Reply With Quote #25

can i do with this plugin then 11 am server automaticali off and i dont need write comand
edwa_03 is offline
chris
Senior Member
Join Date: Mar 2007
Location: America
Old 05-17-2008 , 21:40   Re: Daily Restart
Reply With Quote #26

I've read some of the posts in this thread claiming thing plugin does not acually work; but those were older versions. Since the plugin has been updated to version 1.2, does it work?
__________________
chris is offline
Send a message via AIM to chris
Drakmour
Member
Join Date: Jan 2009
Old 02-21-2009 , 16:41   Re: Daily Restart
Reply With Quote #27

And is it possible to write exact time when the server should restart? For example make 4.a.m. is time to restart?
Drakmour is offline
Rirre
Veteran Member
Join Date: Nov 2006
Old 08-06-2009 , 08:54   Re: Daily Restart
Reply With Quote #28

I would also like to specify time to 4:00 AM, my server get often disconnected from Steam servers everyday and all get this annoying
Error verifying STEAM UserID Ticket(server was
unable to contact the authentication server).

I use v1.2, I have to restart the server all the time on every morning for it to connect even when the server was restarted at 0:00 AM

Last edited by Rirre; 08-06-2009 at 08:57.
Rirre 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 20:55.


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