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

[ANY] Restart Empty Server (or Map)


Post New Thread Reply   
 
Thread Tools Display Modes
JLmelenchon
Senior Member
Join Date: Mar 2019
Old 08-01-2022 , 05:37   Re: [ANY] Restart Empty Server (or Map)
Reply With Quote #81

Quote:
Originally Posted by Dragokas View Post
JLmelenchon, just checked "crash" command on my fully updated L4D2 Linux server, and it is still working.
Also, current version of this plugin correctly restart server there.

My config:
Code:
Left 4 Dead 2 build 8554968
Linux Debian
LinuxGSM installation script
MetaMod v1.11.0.1148
SourceMod v1.11.0.6906
server.cfg
Code:
sm_cvar sv_hibernate_when_empty "0"
sm_cvar sb_all_bot_game 1
sm_cvar allow_all_bot_survivor_team 1
This is what happen if i enter _restart in server console.

[2022-08-01 114:11]: Mon Aug 1 094:11 UTC 2022: Server Quit
[2022-08-01 114:11] [NodePanel]: Game server process offline.

Then the server never restart.

edit: Apparently i found a roundabout way, planning an automatic command with the panel of my server host that start the server when he is offline. The plugin is a little slow to launch the restart command but it seems work like that.

edit 2:
Actually this was not the problem.
sv_hibernate_when_empty "0" was going back to his original value and was creating a conflict, so i put it in 3 places and it works lol: server.cfg, autoexec.cfg, sourcemod.cfg

Last edited by JLmelenchon; 08-01-2022 at 08:27.
JLmelenchon is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 08-01-2022 , 10:05   Re: [ANY] Restart Empty Server (or Map)
Reply With Quote #82

JLmelenchon, I'm using "crash" command:

sm_restart_empty_method 2
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
asdfxD
Veteran Member
Join Date: Apr 2011
Old 10-31-2022 , 00:36   Re: [ANY] Restart Empty Server (or Map)
Reply With Quote #83

plugin stopped working, it does not change the map anymore since latest csgo update. it was working fine before.

edit: it works, some sourcemod files where assigned to the root user....

Last edited by asdfxD; 10-31-2022 at 00:43.
asdfxD is offline
3ipKa
Member
Join Date: Jul 2013
Old 11-10-2022 , 04:57   Re: [ANY] Restart Empty Server (or Map)
Reply With Quote #84

Well, I set sm_restart_empty_method "3", left in server.cfg sm_cvar sv_hibernate_when_empty "1" and server doesn's change map to default, as I can see it goes hibirnate, if i manually change sv_hibernate_when_empty to 0, plugin will change map and log it in file. Maybe i do somthing wrong?

Time ago I a bit edit your plugin, so it do hibernate server after map change with sv_hibernate_when_empty 0 in server cfg, 'cause i cant make it to work another way, but again, maybe i do somthing wrong? )
3ipKa is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 11-10-2022 , 05:40   Re: [ANY] Restart Empty Server (or Map)
Reply With Quote #85

Maybe yes or not, I don't have time on it to test what's happen with latest game updates.
Edit it as as you wish or think to make better.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Forgetest
Member
Join Date: Aug 2020
Old 01-07-2023 , 06:45   Re: [ANY] Restart Empty Server (or Map)
Reply With Quote #86

A suggestion for unloading Accelerator in rid of finding ext num every time it randomly changes.

PHP Code:
void UnloadAccelerator()
{
    
char responseBuffer[4096];
    
    
// fetch a list of sourcemod extensions
    
ServerCommandEx(responseBuffersizeof(responseBuffer), "%s""sm exts list");
    
    
// matching ext name only should sufiice
    
Regex regex = new Regex("\\[([0-9]+)\\] Accelerator");
    
    
// actually matched?
    // CapcureCount == 2? (see @note of "Regex.GetSubString" in regex.inc)
    
if (regex.Match(responseBuffer) != -&& regex.CaptureCount() == 2)
    {
        
char sAcceleratorExtNum[4];
        
        
// 0 is the full string "[?] Accelerator"
        // 1 is the matched extension number
        
regex.GetSubString(1sAcceleratorExtNumsizeof(sAcceleratorExtNum));
        
        
// unload it
        
ServerCommand("sm exts unload %s 0"sAcceleratorExtNum);
        
ServerExecute();
    }
    
    
delete regex;

Forgetest is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 01-07-2023 , 09:03   Re: [ANY] Restart Empty Server (or Map)
Reply With Quote #87

Forgetest, thanks. I remember that I tried using ServerCommandEx long time ago, but refuses it because it catched the output in weird manner, sometimes partially, sometimes nothing at all. Maybe now it is fixed or it's working differently for various games.
Anyway, going to add your solution as an alternative.
PS. I hope in future somebody make a pull request to SM to be able control extensions by name.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 01-07-2023 at 09:17.
Dragokas is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 01-07-2023 , 10:22   Re: [ANY] Restart Empty Server (or Map)
Reply With Quote #88

Updated.

Quote:
2.6 (07-Jan-2023)
- Added auto-detection of Accelerator extension number (thanks to @Forgetest for coding).
- Command "sm_time renamed to" "sm_restarter_ctime" to prevent possible collisions.
- Added command "sm_restarter_accelerator" - Show auto-detected order number of Accelerator extension.
- Readme updated.
- Compatibilities with SM 1.13.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 01-07-2023 at 10:29.
Dragokas is offline
Forgetest
Member
Join Date: Aug 2020
Old 01-07-2023 , 16:59   Re: [ANY] Restart Empty Server (or Map)
Reply With Quote #89

Sincere apology that I didn't carefully go through test cases as well as little knowledge about regex usage, and as a result it throws errors on servers without Accelerator.
To fix this simply change:
PHP Code:
regex.Match(responseBuffer) != -
to:
PHP Code:
regex.Match(responseBuffer) > 
Forgetest is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 01-08-2023 , 09:32   Re: [ANY] Restart Empty Server (or Map)
Reply With Quote #90

Thanks for notification, I know, I already fixed that while testing.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas 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 08:18.


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