sourcemod icon indicating copy to clipboard operation
sourcemod copied to clipboard

Add OnServerHibernationUpdate forward (closes #1483)

Open ojlanders opened this issue 1 year ago • 1 comments

Adds the OnServerHibernationUpdate forward. OnServerHibernationUpdate_Post() isn't possible to implement because there would be no place for it to be called from after SV_Frame stops executing. Link to Discord discussion: https://discord.com/channels/335290997317697536/335290997317697536/1236880595448233995

ojlanders avatar May 06 '24 03:05 ojlanders

Test script:

#include <sourcemod>

public void OnServerHibernationUpdate(bool state)
{
    PrintToServer("Server hibernation state changed to: %s", state ? "true" : "false");
}

here's the output:

sm_cvar sv_hibernate_when_empty 0
[SM] Changed cvar "sv_hibernate_when_empty" to "0".
L 05/05/2024 - 23:11:48: [basecommands.smx] "Console<0><Console><Console>" changed cvar (cvar "sv_hibernate_when_empty") (value "0")
Server waking up from hibernation
Server hibernation state changed to: false
sm_cvar sv_hibernate_when_empty 1
[SM] Changed cvar "sv_hibernate_when_empty" to "1".
L 05/05/2024 - 23:11:49: [basecommands.smx] "Console<0><Console><Console>" changed cvar (cvar "sv_hibernate_when_empty") (value "1")
Server is hibernating
Server hibernation state changed to: true

ojlanders avatar May 06 '24 03:05 ojlanders