Difference between revisions of "Adding Admins (SourceMod)"

From AlliedModders Wiki
Jump to: navigation, search
m
 
(39 intermediate revisions by 13 users not shown)
Line 1: Line 1:
 +
{{Languages|Adding Admins (SourceMod)}}
 
__FORCETOC__
 
__FORCETOC__
 
SourceMod has as very detailed and flexible administration system, and it can be quite daunting to users.  To simplify things, there are a number of "flags" which specify generic permissions administrators can have.
 
SourceMod has as very detailed and flexible administration system, and it can be quite daunting to users.  To simplify things, there are a number of "flags" which specify generic permissions administrators can have.
  
Aside from that, there are (currently) two provided ways of storing admins.  One via a simplified flat file, and another via a more complex tree-based file.
+
There are currently two provided ways of storing admins.  One is via the admin-flatfile.smx plugin that is enabled by default. This plugin provides two files: a simplified flat file, and another more complex tree-based file. The other way to store admins is using [[SQL Admins (SourceMod)|SQL]].
  
SourceMod provides three methods of authentication by default:
+
SourceMod provides three methods of authentication:
 
*''Steam ID'' (unique to a Steam account)
 
*''Steam ID'' (unique to a Steam account)
 
*''IP Address'' (semi-unique to a given computer, better for LANs)
 
*''IP Address'' (semi-unique to a given computer, better for LANs)
 
*''Name'' (requires a password)
 
*''Name'' (requires a password)
 +
 +
=Quick Start=
 +
On the server, open <code>/addons/sourcemod/configs/admins_simple.ini</code>
 +
 +
In a new line, add the following, replacing yoursteamid (use your client's console '''status''' command to retrieve your Steam ID - formatted as STEAM_n:o:p)
 +
 +
'''"yoursteamid" "99:z"'''
 +
 +
Save the file, then type <code>sm_reloadadmins</code> in the server console. Connect to the server with the game client. Enter sm_admin in the client console, and then return to the game.  You should see the admin menu.
  
 
=Levels=
 
=Levels=
Line 41: Line 51:
 
| Slay/harm other players.
 
| Slay/harm other players.
 
|- class="t2td"
 
|- class="t2td"
| map
+
| changemap
 
| g
 
| g
 
| Change the map or major gameplay features.
 
| Change the map or major gameplay features.
Line 70: Line 80:
 
|- class="t2td"
 
|- class="t2td"
 
| cheats
 
| cheats
| m
+
| n
 
| Change sv_cheats or use cheating commands.
 
| Change sv_cheats or use cheating commands.
 
|- class="t2td"
 
|- class="t2td"
 
| root
 
| root
 
| z
 
| z
| Magically enables all flags.
+
| Magically enables all flags and ignores immunity values.
 +
 
 +
|- class="t2td"
 +
| custom1
 +
| o
 +
| Custom Group 1.
 +
|- class="t2td"
 +
| custom2
 +
| p
 +
| Custom Group 2.
 +
|- class="t2td"
 +
| custom3
 +
| q
 +
| Custom Group 3.
 +
|- class="t2td"
 +
| custom4
 +
| r
 +
| Custom Group 4.
 +
|- class="t2td"
 +
| custom5
 +
| s
 +
| Custom Group 5.
 +
|- class="t2td"
 +
| custom6
 +
| t
 +
| Custom Group 6.
 
|}
 
|}
  
 
=Immunity=
 
=Immunity=
There is no immunity flagInstead, there are three types of immunity:
+
In SourceMod, immunity is a flexible system based on ''immunity levels''.  Every admin can have an arbitrary immunity value assigned to them.  Whether an admin can target another admin depends on who has a higher immunity value.
*''Default'' immunity; immunity from admins who do not have default immunity.
+
 
*''Global'' immunity; immunity from admins who do not have global or default immunity.
+
For example, say Admin #1 has an immunity level of "3" and Admin #2 has an immunity level of "10." Admin #2 can target Admin #1, but Admin #1 cannot target Admin #2.  The numbers are completely arbitrary, and they can be any number equal to or higher than 0.  Note that 0 always implies no immunity.
*''Specific'' immunity; immunity from a specific group (see advanced section).
+
 
 +
By default, admins with the same immunity value can target each other.  This can be changed via <tt>sm_immunity_mode</tt> in <tt>cfg/sourcemod.cfg</tt>.
 +
 
 +
'''Admins with the z flag are not subject to immunity checks.'''  This means they can always target anyone.
 +
 
 +
=Passwords=
 +
Using the passwords method is '''optional'''.
 +
 
 +
For passwords to work, the server administrator must change the <code>PassInfoVar</code> line in <tt>addons/sourcemod/configs/core.cfg</tt>.  For example:
 +
<pre>"PassInfoVar" "_sm1337"</pre>
 +
 
 +
Next, if an admin has a password, the person must set the password via the ''setinfo'' command in the client console.  For example, using the examples above, the player <tt>BAILOPAN</tt> would need to type:
 +
<pre>setinfo "_sm1337" "Gab3n"</pre>
 +
 
 +
To automate this upon connecting to a server, you can create an "autoexec.cfg" file in your client game folder.  This will be located under <tt>SteamApps\common\[game]\[gameabbr]\cfg</tt>.  For example:
 +
*<tt>C:\Program Files\Steam\steamapps\common\Counter-Strike Source\cstrike\cfg</tt>
 +
 
 +
You can also set the password upon connecting.  For Steam and IP authentication, your admin privileges will be automatically assigned if the password is correct.  For name based authentication, your password must be correct before you change your name, or else you will be kicked from the server.
  
 
=Simple Admins=
 
=Simple Admins=
The easiest way to add administrators is through <tt>configs/admins_simple.ini</tt>. This is a flat file which requires two parameters per line: authentication info, and flags.
+
The easiest way to add administrators is through <tt>configs/admins_simple.ini</tt>. This is a flat file which requires two parameters per line: authentication info, and flags.
 +
 
 +
The string's syntax:
 +
 
 +
< > - Required
 +
 
 +
[ ] - Optional
 +
 
 +
/ - Or
 +
<pre>
 +
"<Steam ID/!IP/Steam name>" "[immunity level:]<flag/@group>" ["password"]
 +
</pre>
  
Three examples are provided:
+
Examples:
 
<pre>
 
<pre>
"STEAM_0:1:16" "bce" //kick, ban, slay for this steam ID
+
"STEAM_0:1:16" "bce" //generic, kick, unban for this steam ID. no immunity
"127.0.0.1" "z" //all permissions for this ip
+
"!127.0.0.1" "5:z" //all permissions for this IP, immunity level = 5
"BAILOPAN" "abc" "Gab3n" //name BAILOPAN, password "Gab3n": gets reservation, kick, ban
+
"BAILOPAN" "abc" "Gab3n" //name BAILOPAN, password "Gab3n": gets reservation, generic, kick
 +
"Gaben"                "@Admins"              //name Gaben, group Admins
 
</pre>
 
</pre>
  
=Passwords=
+
=Detailed Admins=
For passwords to work, the server administrator must change the "PassInfoVar" line in <tt>addons/sourcemod/configs/core.cfg</tt>. For example:
+
Alternatively, you can add admins via <tt>configs/admins.cfg</tt>, a more advanced file stored in a KeyValues format.  Each admin is its own block inside a main "Admin" block. You can create and / or modify <tt>admins.cfg</tt> files with [http://forums.alliedmods.net/showthread.php?t=81160 KVManager]. The format is as follows:
<pre>"PassInfoVar" "_sm1337"</pre>
+
 
 +
<pre>Admins
 +
{
 +
"Admin Name"
 +
{
 +
"auth" "[steam|name|ip]"
 +
"identity" "[unique id]"
 +
"[option1]" "[value1]"
 +
"[option2]" "[value2]"
 +
/* .... */
 +
}
 +
}</pre>
 +
 
 +
Available options:
 +
 
 +
<span style="color: red; font-family: consolas;">*</span> - Required
 +
*<tt>auth</tt> <span style="color: red; font-family: consolas;">*</span>: Must be one of <tt>steam</tt>, <tt>name</tt>, or <tt>ip</tt> (unless there is a custom auth method), and instructs SourceMod how to interpret the <tt>identity</tt> value.
 +
*<tt>identity</tt> <span style="color: red; font-family: consolas;">*</span>: Unique value that allows SourceMod to find this admin given an authentication method and the given value.
 +
*<tt>password</tt>: Specifies the password the user must enter (see [[#Passwords|passwords]]).
 +
*<tt>group</tt>: Specifies a group name the user should inherit if available.  More than one "group" line can be specified.  There should be no '@' symbol as there is no ambiguity.
 +
*<tt>flags</tt>: Default access flags the user should receive.
 +
*<tt>immunity</tt>: Default immunity level the user should receive.
 +
 
 +
The admin name is optional (it can be blank).  It is not used internally and is intended for convenience usage by 3rd party tools.
  
Next, if an admin has a password, he or she must set the password via the ''setinfo'' command in the client console.  For example, using the examples above, <tt>BAILOPAN</tt> would need to type:
+
Example:
<pre>setinfo "_sm1337" "Gab3n"</pre>
+
<pre>Admins
 +
{
 +
"BAILOPAN"
 +
{
 +
"auth" "steam"
 +
"identity" "STEAM_0:1:2345"
 +
"flags" "abcdef"
 +
"immunity" "5"
 +
"group" "Awesome Admins"
 +
}
  
To automate this upon connecting to a server, you can create an "autoexec.cfg" file in your client <tt>cstrike</tt> folder.  This will be located under <tt>SteamApps\ACCOUNT\Counter-Strike Source\cstrike\cfg</tt>.  For example:
+
"Blue Crab"
*<tt>C:\program files\steam\steamapps\bailopan\counter-strike source\cstrike\cfg</tt>
+
{
 +
"auth" "steam"
 +
"identity" "STEAM_0:1:666666"
 +
"flags" "z"
 +
"immunity" "99"
 +
}
 +
}</pre>
  
You can also set the password upon connecting.  For steam and IP authentication, your admin privileges will be automatically assigned if the password is correct.  For name based authentication, your password must be correct before you change your name, or else you will be kicked from the server.
+
=See Also=
 +
*[[Adding Groups (SourceMod)]]
 +
*[[Overriding Command Access (SourceMod)]]
  
 
[[Category:SourceMod Documentation]]
 
[[Category:SourceMod Documentation]]

Latest revision as of 02:22, 9 September 2019

Language: English  • русский • 中文

SourceMod has as very detailed and flexible administration system, and it can be quite daunting to users. To simplify things, there are a number of "flags" which specify generic permissions administrators can have.

There are currently two provided ways of storing admins. One is via the admin-flatfile.smx plugin that is enabled by default. This plugin provides two files: a simplified flat file, and another more complex tree-based file. The other way to store admins is using SQL.

SourceMod provides three methods of authentication:

  • Steam ID (unique to a Steam account)
  • IP Address (semi-unique to a given computer, better for LANs)
  • Name (requires a password)

Quick Start

On the server, open /addons/sourcemod/configs/admins_simple.ini

In a new line, add the following, replacing yoursteamid (use your client's console status command to retrieve your Steam ID - formatted as STEAM_n:o:p)

"yoursteamid" "99:z"

Save the file, then type sm_reloadadmins in the server console. Connect to the server with the game client. Enter sm_admin in the client console, and then return to the game. You should see the admin menu.

Levels

First, let's quickly run down the provided levels:

Name Flag Purpose
reservation a Reserved slot access.
generic b Generic admin; required for admins.
kick c Kick other players.
ban d Ban other players.
unban e Remove bans.
slay f Slay/harm other players.
changemap g Change the map or major gameplay features.
cvar h Change most cvars.
config i Execute config files.
chat j Special chat privileges.
vote k Start or create votes.
password l Set a password on the server.
rcon m Use RCON commands.
cheats n Change sv_cheats or use cheating commands.
root z Magically enables all flags and ignores immunity values.
custom1 o Custom Group 1.
custom2 p Custom Group 2.
custom3 q Custom Group 3.
custom4 r Custom Group 4.
custom5 s Custom Group 5.
custom6 t Custom Group 6.

Immunity

In SourceMod, immunity is a flexible system based on immunity levels. Every admin can have an arbitrary immunity value assigned to them. Whether an admin can target another admin depends on who has a higher immunity value.

For example, say Admin #1 has an immunity level of "3" and Admin #2 has an immunity level of "10." Admin #2 can target Admin #1, but Admin #1 cannot target Admin #2. The numbers are completely arbitrary, and they can be any number equal to or higher than 0. Note that 0 always implies no immunity.

By default, admins with the same immunity value can target each other. This can be changed via sm_immunity_mode in cfg/sourcemod.cfg.

Admins with the z flag are not subject to immunity checks. This means they can always target anyone.

Passwords

Using the passwords method is optional.

For passwords to work, the server administrator must change the PassInfoVar line in addons/sourcemod/configs/core.cfg. For example:

"PassInfoVar"			"_sm1337"

Next, if an admin has a password, the person must set the password via the setinfo command in the client console. For example, using the examples above, the player BAILOPAN would need to type:

setinfo "_sm1337" "Gab3n"

To automate this upon connecting to a server, you can create an "autoexec.cfg" file in your client game folder. This will be located under SteamApps\common\[game]\[gameabbr]\cfg. For example:

  • C:\Program Files\Steam\steamapps\common\Counter-Strike Source\cstrike\cfg

You can also set the password upon connecting. For Steam and IP authentication, your admin privileges will be automatically assigned if the password is correct. For name based authentication, your password must be correct before you change your name, or else you will be kicked from the server.

Simple Admins

The easiest way to add administrators is through configs/admins_simple.ini. This is a flat file which requires two parameters per line: authentication info, and flags.

The string's syntax:

< > - Required

[ ] - Optional

/ - Or

"<Steam ID/!IP/Steam name>" "[immunity level:]<flag/@group>" ["password"]

Examples:

"STEAM_0:1:16"		"bce"			//generic, kick, unban for this steam ID. no immunity
"!127.0.0.1"		"5:z"			//all permissions for this IP, immunity level = 5
"BAILOPAN"		"abc"	"Gab3n"		//name BAILOPAN, password "Gab3n": gets reservation, generic, kick
"Gaben"                 "@Admins"               //name Gaben, group Admins

Detailed Admins

Alternatively, you can add admins via configs/admins.cfg, a more advanced file stored in a KeyValues format. Each admin is its own block inside a main "Admin" block. You can create and / or modify admins.cfg files with KVManager. The format is as follows:

Admins
{
	"Admin Name"
	{
		"auth"		"[steam|name|ip]"
		"identity"	"[unique id]"
		"[option1]"	"[value1]"
		"[option2]"	"[value2]"
		/* .... */
	}
}

Available options:

* - Required

  • auth *: Must be one of steam, name, or ip (unless there is a custom auth method), and instructs SourceMod how to interpret the identity value.
  • identity *: Unique value that allows SourceMod to find this admin given an authentication method and the given value.
  • password: Specifies the password the user must enter (see passwords).
  • group: Specifies a group name the user should inherit if available. More than one "group" line can be specified. There should be no '@' symbol as there is no ambiguity.
  • flags: Default access flags the user should receive.
  • immunity: Default immunity level the user should receive.

The admin name is optional (it can be blank). It is not used internally and is intended for convenience usage by 3rd party tools.

Example:

Admins
{
	"BAILOPAN"
	{
		"auth"		"steam"
		"identity"	"STEAM_0:1:2345"
		"flags"		"abcdef"
		"immunity"	"5"
		"group"		"Awesome Admins"
	}

	"Blue Crab"
	{
		"auth"		"steam"
		"identity"	"STEAM_0:1:666666"
		"flags"		"z"
		"immunity"	"99"
	}
}

See Also