cs16-dm-server: CS 1.6 deathmatch server in Docker
One-command setup (SteamCMD + pinned, checksum-verified ReHLDS / ReGameDLL / Metamod-R / AMXX / ReAPI / ReUnion / CSDM-ReAPI / YaPB / GunGame), .env settings, ./cs menu (map, DM/GunGame mode, bots, kill counter, restart, update), own plugins (extras, rtv, mode switch), all-time kill counter, watchdog + nightly backup, docs for admins and players. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
commit
7e9cbee14d
33 files changed
+1890
No files matched your search
@@ -0,0 +1,84 @@
|
||||
// esef_mode.sma - switch the server between FFA deathmatch (CSDM-ReAPI) and GunGame.
|
||||
// Server command (use via RCON): esef_mode -> prints the current mode
|
||||
// esef_mode gg | dm -> switches and reloads the current map
|
||||
// AMXX loads every configs/plugins-*.ini at each map change, so a mode is just which of the
|
||||
// two plugin lists is named .ini and which .ini.off. The choice survives restarts.
|
||||
|
||||
#include <amxmodx>
|
||||
#include <amxmisc>
|
||||
|
||||
new const GG_INI[] = "plugins-gungame.ini"
|
||||
new const DM_INI[] = "plugins-CSDM_ReAPI.ini"
|
||||
|
||||
new g_dir[64]
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin("DM/GG mode switch", "1.0", "cs16-dm-server")
|
||||
register_srvcmd("esef_mode", "CmdMode", -1, "[dm|gg] - show or switch game mode (reloads the map)")
|
||||
get_configsdir(g_dir, charsmax(g_dir))
|
||||
}
|
||||
|
||||
bool:IsOn(const ini[])
|
||||
{
|
||||
new path[128]
|
||||
formatex(path, charsmax(path), "%s/%s", g_dir, ini)
|
||||
return bool:file_exists(path)
|
||||
}
|
||||
|
||||
// enable: <ini>.off -> <ini> disable: <ini> -> <ini>.off
|
||||
SetIni(const ini[], bool:enable)
|
||||
{
|
||||
new on[128], off[128]
|
||||
formatex(on, charsmax(on), "%s/%s", g_dir, ini)
|
||||
formatex(off, charsmax(off), "%s/%s.off", g_dir, ini)
|
||||
if (enable && !file_exists(on) && file_exists(off))
|
||||
rename_file(off, on, 1)
|
||||
else if (!enable && file_exists(on))
|
||||
rename_file(on, off, 1)
|
||||
}
|
||||
|
||||
public CmdMode()
|
||||
{
|
||||
new arg[8]
|
||||
read_argv(1, arg, charsmax(arg))
|
||||
|
||||
new bool:gg = IsOn(GG_INI)
|
||||
if (!arg[0])
|
||||
{
|
||||
server_print("[esef_mode] current mode: %s", gg ? "gg (GunGame)" : "dm (FFA deathmatch)")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
new bool:wantGG
|
||||
if (equali(arg, "gg"))
|
||||
wantGG = true
|
||||
else if (equali(arg, "dm"))
|
||||
wantGG = false
|
||||
else
|
||||
{
|
||||
server_print("[esef_mode] usage: esef_mode [dm|gg]")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
SetIni(GG_INI, wantGG)
|
||||
SetIni(DM_INI, !wantGG)
|
||||
|
||||
if (IsOn(GG_INI) != wantGG || IsOn(DM_INI) == wantGG)
|
||||
{
|
||||
server_print("[esef_mode] could not rename the plugin lists in %s", g_dir)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
server_print("[esef_mode] switching to %s, reloading map in 3s", wantGG ? "gg" : "dm")
|
||||
client_print_color(0, print_team_default, "^4[mode]^1 Switching to ^3%s^1 - map reloads in 3 seconds...", wantGG ? "GunGame" : "Deathmatch")
|
||||
set_task(3.0, "Reload")
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
public Reload()
|
||||
{
|
||||
new map[32]
|
||||
get_mapname(map, charsmax(map))
|
||||
server_cmd("changelevel %s", map)
|
||||
}
|
||||
Reference in new issue
Block a user