AutoConfigs (SourceMod Scripting)

From AlliedModders Wiki
Revision as of 02:16, 18 June 2007 by BAILOPAN (talk | contribs) (New page: __FORCETOC__ SourceMod provides a system for simple plugins to automatically generate config files which get executed on load. This is done via the <tt>AutoExecConfig</tt> native in <tt>s...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

SourceMod provides a system for simple plugins to automatically generate config files which get executed on load. This is done via the AutoExecConfig native in scripting/include/sourcemod.inc.

Usage

There are three parameters to this call:

  • autoCreate - If true, SourceMod will dump all ConVars created by the plugin into a config file if the specified config file does not exist.
  • name - Name of the config file (excluding the .cfg extension). If empty, the plugin's name will be used instead, with plugin. prepended. For example, hat.smx becomes plugin.hat.cfg.
  • folder - Optionally change the folder under the main cfg folder. By default this is sourcemod, and configs go in cfg/sourcemod/. If empty, the config will be in cfg/.

Note: It is possible to write nested folders; SourceMod will attempt to create each one.

Note: If you have multiple AutoExecConfig calls marked with autoCreate being true, the first file to be auto created will prevent any others from being created. Thus, there is no way to automatically split cvars between multiple files.


Example Dump

The autoCreate feature exports a config file that looks like this:

// This file was auto-generated by SourceMod (v1.0.0.986)
// ConVars for plugin "hat.smx"


// MySQL database
// -
// Default: ""
mysqlk_database ""

// MySQL host, use this to configure various
// things for your server.
// -
// Default: "localhost"
mysqlk_host "localhost"