War Mode (SourceMod)

From AlliedModders Wiki
Revision as of 22:44, 31 March 2008 by Fireandy (talk | contribs) (Sample Files: Corrected warmode_off to warmode_on and vice versa)
Jump to: navigation, search


SourceMod does not have a "war mode" built-in. Instead, it has options that let you lock-down SourceMod to only keep a few plugins loaded. Matches can be completed without SourceMod interfering, and once done, SourceMod can be "unlocked" again. This way you can still retain administrative control.

Of course, it is subjective as to which plugins are usable in war mode. You can tweak SourceMod to achieve the functionality you wish to retain.


Safe Plugins

There are a few plugins that are absolutely safe to use for matches. They are:

  • adminhelp.smx - Provides the sm_help command.
  • adminmenu.smx - Provides the sm_admin command. Note that menu items are only added from other plugins, and thus enabling the menu plugin will not add abusive admin commands unless the plugin implementing those commands is also loaded.
  • admin-flatfile.smx, admin-sql-threaded.smx, and admin-sql-prefetch.smx - These three plugins simply load administrators.
  • basebans.smx - Ban/unban functionality. Click here for command listing.
  • basecommands.smx - General, non-abusive admin commands. Click here for command listing.

War Mode Configs

Implementing warmode is very simple. Two sample configs are provided as cfg/sourcemod/sm_warmode_on.cfg and cfg/sourcemod/sm_warmode_off.cfg.

The first file, sm_warmode_on.cfg, does three things:

  • Unloads all plugins.
  • Re-loads the "safe" plugins.
  • Locks any more plugins from being loaded.

The second file, sm_warmode_off.cfg, removes the plugin loading lock, and then reloads all plugins from the plugins folder (as would happen on server start).

You can simply use sm_execcfg, rcon exec, or the admin menu to run these configs. Of course, you can also change or rename them. Samples are provided in the default package, and also reproduced below.

Sample Files

sm_warmode_on.cfg:

//This file unloads all plugins, re-loads a few "safe" ones, and then prevents 
//any more plugins from being loaded.
sm plugins unload_all
sm plugins load basebans.smx
sm plugins load basecommands.smx
sm plugins load admin-flatfile.smx
sm plugins load adminhelp.smx
sm plugins load adminmenu.smx
sm plugins load_lock

sm_warmode_off.cfg:

//This file re-enables a server from "war mode" by unlocking plugin loading 
//and refreshing the plugins list.
sm plugins load_unlock
sm plugins refresh