...this could done by adding few bots to play all the time. (bot_join_after_player 0) and need change more cvars etc. etc.
*edit
and use
sv_hibernate_when_empty 0
I don't know how you manage map cycle and votes...
But try this.
in ...cfg/sourcemod/sourcemod.cfg add in first line
Code:
sm_nextmap " " // This stop loop same map
And here one kind script
PHP Code:
#include <sdktools>
ConVar mp_timelimit;
Handle my_timer;
public void OnPluginStart()
{
HookEvent("switch_team", switch_team); // This event is executed by human players only
mp_timelimit = FindConVar("mp_timelimit");
}
public void switch_team(Event event, const char[] name, bool dontBroadcast)
{
//PrintToServer("switch_team");
//
//- "numPlayers" = "0"
//- "numSpectators" = "0"
//
if(event.GetInt("numPlayers") == 0 && event.GetInt("numSpectators") == 0)
{
//PrintToServer("switch_team create timer");
CreateTimerGameEnd();
}
else
{
if(my_timer != null)
delete my_timer;
}
}
public void OnConfigsExecuted()
{
//PrintToServer("OnConfigsExecuted");
// Make timer when map start
my_timer = null;
CreateTimerGameEnd();
}
public void CreateTimerGameEnd()
{
if(my_timer != null)
delete my_timer;
float seconds = 120.0; // Default 2 minutes
if(mp_timelimit != null)
{
float timelimit = mp_timelimit.FloatValue;
if(timelimit >= 1.0 && timelimit <= 60.0) // If mp_timelimit is in range of one minute and 60 minutes, update timer to that
{
seconds = timelimit * 60.0;
}
}
CreateTimer(seconds, delay, _, TIMER_FLAG_NO_MAPCHANGE);
}
public Action delay(Handle timer)
{
my_timer = null;
//PrintToServer("Timer delay executed");
int entity = FindEntityByClassname(-1, "game_end");
if(entity == -1)
{
entity = CreateEntityByName("game_end");
}
if(entity != -1)
{
PrintToServer("EndGame");
AcceptEntityInput(entity, "EndGame");
}
return Plugin_Continue;
}
- Timer stop when player enter in team T or CT or spectator.
- Plugin look only human player count.
- Default is 2 minutes,
unless you have set up mp_timelimit between 1 - 60 minutes, timer will use that.
__________________