Difference between revisions of "Admin Commands (SourceMod)"

From AlliedModders Wiki
Jump to: navigation, search
m
m (How to Target: users can only be used by the server console, status is better because client consoles can also use)
 
(4 intermediate revisions by 2 users not shown)
Line 10: Line 10:
 
<ul>
 
<ul>
 
  <li>name - Exact name match, or partial name match (if the partial string is unique).</li>
 
  <li>name - Exact name match, or partial name match (if the partial string is unique).</li>
  <li>#userid - If userid is numeric, the player will be targeted by their userid (found via the "users" command).</li>
+
  <li>#userid - If userid is numeric, the player will be targeted by their userid (found via the "status" command).</li>
 
  <li>#steamid - Matches by Steam ID.  If you use colons (:), you must enclose in quotes.  Otherwise, you can use an underscore (_) instead.  Examples: <tt>"#STEAM_0:1:4433"</tt>, <tt>#STEAM_0_1_4433</tt></li>
 
  <li>#steamid - Matches by Steam ID.  If you use colons (:), you must enclose in quotes.  Otherwise, you can use an underscore (_) instead.  Examples: <tt>"#STEAM_0:1:4433"</tt>, <tt>#STEAM_0_1_4433</tt></li>
 
  <li>#&lt;name&gt; - Exact name match after the # sign.
 
  <li>#&lt;name&gt; - Exact name match after the # sign.
Line 34: Line 34:
 
<ul>
 
<ul>
 
  <li>@red - All RED team members</li>
 
  <li>@red - All RED team members</li>
  <li>@blue - All BLU team members</li>
+
  <li>@blue - All BLUE team members</li>
 
</ul>
 
</ul>
 
  
 
=Basic Commands=
 
=Basic Commands=
Line 51: Line 50:
 
| basebans
 
| basebans
 
| rcon
 
| rcon
| <time> <steamid> [reason]
+
| <nowiki><time> <steamid> [reason]</nowiki>
 
| Adds a Steam ID to Source's ban list.
 
| Adds a Steam ID to Source's ban list.
 
|-
 
|-
Line 81: Line 80:
 
| basecommands
 
| basecommands
 
| cvar
 
| cvar
| <cvar> [value]
+
| <nowiki><cvar> [value]</nowiki>
 
| Retrieves or changes a cvar value.  Protected cvars can only be accessed with password access, and sv_cheats can only be accessed with cheat access. To add a cvar to the protected list (which by default contains all cvars flagged PROTECTED, rcon_password, sm_show_activity, and sm_immunity_mode), use sm_cvar protect <name>.
 
| Retrieves or changes a cvar value.  Protected cvars can only be accessed with password access, and sv_cheats can only be accessed with cheat access. To add a cvar to the protected list (which by default contains all cvars flagged PROTECTED, rcon_password, sm_show_activity, and sm_immunity_mode), use sm_cvar protect <name>.
 
|-
 
|-
Line 87: Line 86:
 
| basecommands
 
| basecommands
 
| config
 
| config
| <filename>
+
| <nowiki><filename></nowiki>
 
| Executes a config file (path not needed, but extension is).
 
| Executes a config file (path not needed, but extension is).
 
|-
 
|-
Line 93: Line 92:
 
| adminhelp
 
| adminhelp
 
| admin
 
| admin
| [page|search]
+
| <nowiki>[page|search]</nowiki>
 
| Lists all admin commands.  Output is paginated and a page number can be specified.  Alternately, a search term can be specified to search for a specific command.
 
| Lists all admin commands.  Output is paginated and a page number can be specified.  Alternately, a search term can be specified to search for a specific command.
 
|-
 
|-
Line 105: Line 104:
 
| basecommands
 
| basecommands
 
| map
 
| map
| <map>
+
| <nowiki><map></nowiki>
 
| Changes the current map.
 
| Changes the current map.
 
|-
 
|-
Line 111: Line 110:
 
| basecommands
 
| basecommands
 
| rcon
 
| rcon
| <argstring>
+
| <nowiki><argstring></nowiki>
 
| Executes the argument string via rcon.  You will only see RCON output on SourceMod 1.4 or above.
 
| Executes the argument string via rcon.  You will only see RCON output on SourceMod 1.4 or above.
 
|-
 
|-
Line 147: Line 146:
 
| funcommands
 
| funcommands
 
| slay
 
| slay
| &lt;target>
+
| <nowiki><target></nowiki>
 
| Adds a ring around each target, making them easily visible.
 
| Adds a ring around each target, making them easily visible.
 
|-
 
|-
Line 153: Line 152:
 
| funcommands
 
| funcommands
 
| slay
 
| slay
| &lt;target> [time]
+
| <nowiki><target> [time]</nowiki>
 
| Sets the target(s) on fire for the specified amount of time.  This may or may not work fully on certain games (for example, TF2 is missing the fire sprite, but clients will bleed/lose health).  If specified, burning effect will stop after the [time] seconds.
 
| Sets the target(s) on fire for the specified amount of time.  This may or may not work fully on certain games (for example, TF2 is missing the fire sprite, but clients will bleed/lose health).  If specified, burning effect will stop after the [time] seconds.
 
|-
 
|-
Line 159: Line 158:
 
| basechat
 
| basechat
 
| chat
 
| chat
| &lt;message>
+
| <nowiki><message></nowiki>
 
| Sends a say-chat message to all admins.
 
| Sends a say-chat message to all admins.
 
|-
 
|-
Line 165: Line 164:
 
| basechat
 
| basechat
 
| chat
 
| chat
| &lt;message>
+
| <nowiki><message></nowiki>
 
| Sends a centered message to all players.
 
| Sends a centered message to all players.
 
|-
 
|-
Line 171: Line 170:
 
| basecomm
 
| basecomm
 
| chat
 
| chat
| &lt;target>
+
| <nowiki><target></nowiki>
 
| Prevents the target(s) from using messagemode/say chat.
 
| Prevents the target(s) from using messagemode/say chat.
 
|-
 
|-
Line 177: Line 176:
 
| basechat
 
| basechat
 
| chat
 
| chat
| &lt;message>
+
| <nowiki><message></nowiki>
 
| Sends a message to all players via a center-bottom hint box.
 
| Sends a message to all players via a center-bottom hint box.
 
|-
 
|-
Line 183: Line 182:
 
| basechat
 
| basechat
 
| chat
 
| chat
| &lt;message>
+
| <nowiki><message></nowiki>
 
| Sends a message as a menu panel (only meaningful on games that support radio menus).
 
| Sends a message as a menu panel (only meaningful on games that support radio menus).
 
|-
 
|-
Line 189: Line 188:
 
| basecomm
 
| basecomm
 
| chat
 
| chat
| &lt;target>
+
| <nowiki><target></nowiki>
 
| Prevents the target(s) from using voice chat.
 
| Prevents the target(s) from using voice chat.
 
|-
 
|-
Line 195: Line 194:
 
| sounds
 
| sounds
 
| admin
 
| admin
| &lt;target> &lt;file>
+
| <nowiki><target> <file></nowiki>
 
| Plays a sound file on the server to each target.
 
| Plays a sound file on the server to each target.
 
|-
 
|-
Line 201: Line 200:
 
| basechat
 
| basechat
 
| chat
 
| chat
| &lt;target> <message>
+
| <nowiki><target> <message></nowiki>
 
| Sends a private chat message to a single target.
 
| Sends a private chat message to a single target.
 
|-
 
|-
Line 219: Line 218:
 
| basechat
 
| basechat
 
| chat
 
| chat
| &lt;message>
+
| <nowiki><message></nowiki>
 
| Sends a say-chat message to all players.
 
| Sends a say-chat message to all players.
 
|-
 
|-
Line 225: Line 224:
 
| basecomm
 
| basecomm
 
| chat
 
| chat
| &lt;target>
+
| <nowiki><target></nowiki>
 
| Performs both a gag and mute on the target(s).
 
| Performs both a gag and mute on the target(s).
 
|-
 
|-
Line 231: Line 230:
 
| playercommands
 
| playercommands
 
| slay
 
| slay
| &lt;target> [damage]
+
| <nowiki><target> [damage]</nowiki>
 
| "Slaps" a player, emitting a noise and throwing them in a random direction.  If specified, the damage amount will be subtracted from each target's health.
 
| "Slaps" a player, emitting a noise and throwing them in a random direction.  If specified, the damage amount will be subtracted from each target's health.
 
|-
 
|-
Line 237: Line 236:
 
| playercommands
 
| playercommands
 
| slay
 
| slay
| &lt;target>  
+
| <nowiki><target></nowiki>
 
| Kills a player.
 
| Kills a player.
 
|-
 
|-
Line 243: Line 242:
 
| basechat
 
| basechat
 
| chat
 
| chat
| [color] &lt;message>
+
| <nowiki>[color] <message></nowiki>
 
| Sends a top-left message to all players.  If no color is specified, the text will be white.  Colors available are: white, red, green, blue, yellow, purple, cyan, orange, pink, olive, lime, violet, lightblue.  The names are not case sensitive.
 
| Sends a top-left message to all players.  If no color is specified, the text will be white.  Colors available are: white, red, green, blue, yellow, purple, cyan, orange, pink, olive, lime, violet, lightblue.  The names are not case sensitive.
 
|-
 
|-
Line 249: Line 248:
 
| basecomm
 
| basecomm
 
| chat
 
| chat
| &lt;target>
+
| <nowiki><target></nowiki>
 
| Allows the target(s) to use messagemode/say chat again.
 
| Allows the target(s) to use messagemode/say chat again.
 
|-
 
|-
Line 255: Line 254:
 
| basecomm
 
| basecomm
 
| chat
 
| chat
| &lt;target>
+
| <nowiki><target></nowiki>
 
| Allows the target(s) to use voice chat again.
 
| Allows the target(s) to use voice chat again.
 
|-
 
|-
Line 261: Line 260:
 
| basecomm
 
| basecomm
 
| chat
 
| chat
| &lt;target>
+
| <nowiki><target></nowiki>
 
| Perfoms both an ungag and unmute on the target(s).
 
| Perfoms both an ungag and unmute on the target(s).
 
|}
 
|}
Line 279: Line 278:
 
| basevotes
 
| basevotes
 
| vote
 
| vote
| &lt;question> [answer1] [answer2] [answer3] ...
+
| <nowiki><question> [answer1] [answer2] [answer3] ...</nowiki>
 
| Starts an arbitrary vote with the given arguments as answers. If no answer parameters are supplied, the answer options will be Yes and No localized into each client's language.
 
| Starts an arbitrary vote with the given arguments as answers. If no answer parameters are supplied, the answer options will be Yes and No localized into each client's language.
 
|-
 
|-
Line 291: Line 290:
 
| basevotes
 
| basevotes
 
| vote, ban
 
| vote, ban
| &lt;target> [reason]
+
| <nowiki><target> [reason]</nowiki>
 
| Starts a vote to ban a single player for thirty minutes.
 
| Starts a vote to ban a single player for thirty minutes.
 
|-
 
|-
Line 297: Line 296:
 
| funvotes
 
| funvotes
 
| vote, slay
 
| vote, slay
| &lt;target>
+
| <nowiki><target></nowiki>
 
| Starts a vote to burn a single player.
 
| Starts a vote to burn a single player.
 
|-
 
|-
Line 309: Line 308:
 
| funvotes
 
| funvotes
 
| vote
 
| vote
| &lt;amount> [amount2] [amount3] ...
+
| <nowiki><amount> [amount2] [amount3] ...</nowiki>
 
| Initiates a vote to change the value of sv_gravity.
 
| Initiates a vote to change the value of sv_gravity.
 
|-
 
|-
Line 315: Line 314:
 
| basevotes
 
| basevotes
 
| vote, kick
 
| vote, kick
| &lt;target> [reason]
+
| <nowiki><target> [reason]</nowiki>
 
| Starts a vote to kick a single player.
 
| Starts a vote to kick a single player.
 
|-
 
|-
Line 321: Line 320:
 
| basevotes
 
| basevotes
 
| vote, map
 
| vote, map
| &lt;map> [map2] [map3] ...
+
| <nowiki><map> [map2] [map3] ...</nowiki>
 
| Starts a vote to change the map.
 
| Starts a vote to change the map.
 
|-
 
|-
Line 327: Line 326:
 
| funvotes
 
| funvotes
 
| vote, slay
 
| vote, slay
| &lt;target>
+
| <nowiki><target></nowiki>
 
| Starts a vote to slay a single player.
 
| Starts a vote to slay a single player.
 
|}
 
|}
  
 
[[Category:SourceMod Documentation]]
 
[[Category:SourceMod Documentation]]

Latest revision as of 22:57, 3 November 2019

Language: English  • 中文

This page lists all of the major admin commands in SourceMod.

Chat Triggers: Remember that commands do not have to be entered through the console; they can be entered via chat triggers. For example, saying "!ban bail" in chat will execute the same command as "sm_ban" and forward the output to chat. You can also use "/" instead of "!" to suppress your command from being shown to users.

How to Target

General targets:

  • name - Exact name match, or partial name match (if the partial string is unique).
  • #userid - If userid is numeric, the player will be targeted by their userid (found via the "status" command).
  • #steamid - Matches by Steam ID. If you use colons (:), you must enclose in quotes. Otherwise, you can use an underscore (_) instead. Examples: "#STEAM_0:1:4433", #STEAM_0_1_4433
  • #<name> - Exact name match after the # sign.
  • @all - All players (available on most commands).
  • @bots - All bots (available on most commands).
  • @alive - All alive players (available on most commands that accept alive players).
  • @dead - All dead players (available on most commands that accept dead players).
  • @humans - All non-bot players (available on most commands).
  • @aim - Current player the admin is directly aiming at.
  • @me - Target self.
  • @!me - Target everyone but yourself.

Note that name matches occur last, "magic targets" (such as # and @) are processed first. This means that "@all" will target @all players, even if there is a player named "@all". You should target "#@all" instead.

Counter-Strike only:

  • @ct or @cts - All Counter-Terrorists
  • @t or @ts - All Terrorists

Team Fortress 2 Only:

  • @red - All RED team members
  • @blue - All BLUE team members

Basic Commands

These are basic commands found in plugins that have been deemed safe for War Mode; they provide simple functionality for administering your server.

Command Plugin Access Format Description
sm_addban basebans rcon <time> <steamid> [reason] Adds a Steam ID to Source's ban list.
sm_admin adminmenu admin Displays the admin menu.
sm_ban basebans ban <#userid|name> <minutes|0> [reason] Bans a client.
sm_banip basebans ban <ip|#userid|name> <time> [reason] Adds an IP address to Source's ban list. Only someone with rcon access can ban an arbitrary IP.
sm_cancelvote basecommands vote Cancels any vote in progress.
sm_cvar basecommands cvar <cvar> [value] Retrieves or changes a cvar value. Protected cvars can only be accessed with password access, and sv_cheats can only be accessed with cheat access. To add a cvar to the protected list (which by default contains all cvars flagged PROTECTED, rcon_password, sm_show_activity, and sm_immunity_mode), use sm_cvar protect <name>.
sm_execcfg basecommands config <filename> Executes a config file (path not needed, but extension is).
sm_help adminhelp admin [page|search] Lists all admin commands. Output is paginated and a page number can be specified. Alternately, a search term can be specified to search for a specific command.
sm_kick basecommands kick <#userid|name> [reason] Kicks a player.
sm_map basecommands map <map> Changes the current map.
sm_rcon basecommands rcon <argstring> Executes the argument string via rcon. You will only see RCON output on SourceMod 1.4 or above.
sm_reloadadmins basecommands config Refreshes the Admin cache from all sources.
sm_unban basebans unban <steamid|ip> Unbans a Steam ID or an IP.
sm_who basecommands admin [#userid|name] Lists all users and their access rights, or a specific user's access rights.

Extended Commands

These commands provide extended functionality that may not be present on all games, either due to game or engine differences. In general, they work on the most popular mods. If you have a mod which is new, or not supported yet due to lower popularity, file a feature request.

Command Plugin Access Format Description
sm_beacon funcommands slay <target> Adds a ring around each target, making them easily visible.
sm_burn funcommands slay <target> [time] Sets the target(s) on fire for the specified amount of time. This may or may not work fully on certain games (for example, TF2 is missing the fire sprite, but clients will bleed/lose health). If specified, burning effect will stop after the [time] seconds.
sm_chat basechat chat <message> Sends a say-chat message to all admins.
sm_csay basechat chat <message> Sends a centered message to all players.
sm_gag basecomm chat <target> Prevents the target(s) from using messagemode/say chat.
sm_hsay basechat chat <message> Sends a message to all players via a center-bottom hint box.
sm_msay basechat chat <message> Sends a message as a menu panel (only meaningful on games that support radio menus).
sm_mute basecomm chat <target> Prevents the target(s) from using voice chat.
sm_play sounds admin <target> <file> Plays a sound file on the server to each target.
sm_psay basechat chat <target> <message> Sends a private chat message to a single target.
sm_rename playercommands slay <#userid|name> Changes the name of a player.
sm_resetcvar basecommands cvar <cvar> Resets CVAR value back to default.
sm_say basechat chat <message> Sends a say-chat message to all players.
sm_silence basecomm chat <target> Performs both a gag and mute on the target(s).
sm_slap playercommands slay <target> [damage] "Slaps" a player, emitting a noise and throwing them in a random direction. If specified, the damage amount will be subtracted from each target's health.
sm_slay playercommands slay <target> Kills a player.
sm_tsay basechat chat [color] <message> Sends a top-left message to all players. If no color is specified, the text will be white. Colors available are: white, red, green, blue, yellow, purple, cyan, orange, pink, olive, lime, violet, lightblue. The names are not case sensitive.
sm_ungag basecomm chat <target> Allows the target(s) to use messagemode/say chat again.
sm_unmute basecomm chat <target> Allows the target(s) to use voice chat again.
sm_unsilence basecomm chat <target> Perfoms both an ungag and unmute on the target(s).

Vote Commands

These commands are listed separately as they are all related to voting. None of them are available in war mode by default.

Command Plugin Access Format Description
sm_vote basevotes vote <question> [answer1] [answer2] [answer3] ... Starts an arbitrary vote with the given arguments as answers. If no answer parameters are supplied, the answer options will be Yes and No localized into each client's language.
sm_votealltalk funvotes vote Starts a vote to change the value of sv_alltalk.
sm_voteban basevotes vote, ban <target> [reason] Starts a vote to ban a single player for thirty minutes.
sm_voteburn funvotes vote, slay <target> Starts a vote to burn a single player.
sm_voteff funvotes vote Starts a vote to change the value of mp_friendlyfire.
sm_votegravity funvotes vote <amount> [amount2] [amount3] ... Initiates a vote to change the value of sv_gravity.
sm_votekick basevotes vote, kick <target> [reason] Starts a vote to kick a single player.
sm_votemap basevotes vote, map <map> [map2] [map3] ... Starts a vote to change the map.
sm_voteslay funvotes vote, slay <target> Starts a vote to slay a single player.