Difference between revisions of "Ru:AutoConfigs (SourceMod Scripting)"

From AlliedModders Wiki
Jump to: navigation, search
m
(little translating)
Line 1: Line 1:
 
__FORCETOC__
 
__FORCETOC__
SourceMod provides a system for simple plugins to automatically generate config files which get executed on loadThis is done via the <tt>AutoExecConfig</tt> native in <tt>scripting/include/sourcemod.inc</tt>.
+
SourceMod обеспечивает простую систему для плагинов, которая автоматически генерирует конфиг файлы, которые загружаются при загрузкеЭто обеспечивается с помощью <tt>AutoExecConfig</tt> размещенной в <tt>scripting/include/sourcemod.inc</tt>.
  
Once all configuration files are executed, <tt>OnConfigsExecuted</tt> is called.  This forward will always be called, even if your plugin had no configs or if it was loaded late.
+
После того как все конфиг файлы исполнены, <tt>OnConfigsExecuted</tt> должно вызываться.  This forward will always be called, even if your plugin had no configs or if it was loaded late.  
  
=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.
+
*''autoCreate'' - Если 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 <tt>plugin.</tt> prepended. For example, <tt>hat.smx</tt> becomes <tt>plugin.hat.cfg</tt>.
+
*''name'' - Имя конфиг файла (включая .cfg расширение).  Если пусто имя плагина, то будет использоваться с <tt>plugin.</tt> пометкой. Пример: для плагина <tt>hat.smx</tt> будет создан <tt>plugin.hat.cfg</tt>.
*''folder'' - Optionally change the folder under the main <tt>cfg</tt> folder. By default this is <tt>sourcemod</tt>, and configs go in <tt>cfg/sourcemod/</tt>.  If empty, the config will be in <tt>cfg/</tt>.
+
*''folder'' - При желание можно сменить папку в главной <tt>cfg</tt> папки. По умолчанию это <tt>sourcemod</tt>, и конфиги будут в <tt>cfg/sourcemod/</tt>.  Если пусто, конфиг будет расположен в <tt>cfg/</tt>.
  
''Note'': It is possible to write nested folders; SourceMod will attempt to create each one.
+
''Примичание'': Возможно создать вложенные папки; SourceMod будет пытаться создать каждую из них.
  
''Note'': If you have multiple <tt>AutoExecConfig</tt> 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.
+
''Примичание'': Если у вас несколько <tt>AutoExecConfig</tt> вызовов помеченный '''autoCreate''' being true, the first file to be auto created will prevent any others from being created.  Таким образом, нет возможности автоматически разделить cvars между несколькими файлами .
  
  
=Example Dump=
+
=Пример Dump=
The autoCreate feature exports a config file that looks like this:
+
autoCreate функция создает конфиг файл, который выглядит так:
  
 
<pre>
 
<pre>

Revision as of 20:04, 17 July 2011

SourceMod обеспечивает простую систему для плагинов, которая автоматически генерирует конфиг файлы, которые загружаются при загрузке. Это обеспечивается с помощью AutoExecConfig размещенной в scripting/include/sourcemod.inc.

После того как все конфиг файлы исполнены, OnConfigsExecuted должно вызываться. This forward will always be called, even if your plugin had no configs or if it was loaded late.

Использование

Эти три параметра для вызова:

  • autoCreate - Если true, SourceMod will dump all ConVars created by the plugin into a config file if the specified config file does not exist.
  • name - Имя конфиг файла (включая .cfg расширение). Если пусто имя плагина, то будет использоваться с plugin. пометкой. Пример: для плагина hat.smx будет создан plugin.hat.cfg.
  • folder - При желание можно сменить папку в главной cfg папки. По умолчанию это sourcemod, и конфиги будут в cfg/sourcemod/. Если пусто, конфиг будет расположен в cfg/.

Примичание: Возможно создать вложенные папки; SourceMod будет пытаться создать каждую из них.

Примичание: Если у вас несколько AutoExecConfig вызовов помеченный autoCreate being true, the first file to be auto created will prevent any others from being created. Таким образом, нет возможности автоматически разделить cvars между несколькими файлами .


Пример Dump

autoCreate функция создает конфиг файл, который выглядит так:

// 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"