[HL2MP] Add proper server admin tools #948
Open
+4,033
−36
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The too long did not read version: I feel like some natively built-in server admin tools could be beneficial to folks running servers. While Source already comes with some commands, like
kick
,kickid
,banid
, etc. those only are useful on a listen server and require rcon on a dedicated server.This is not to say this replaces Sourcemod, but this allows those who do not want to download plugins to have admin tools natively built-in the SDK.
I worked for a while on this, hopefully, this is bug-free. This was developed and tested with HL2DM, but I don't see a reason why this wouldn't work on TF2.
Full usage
Server Administration Interface
Introduction
This new server administration interface was implemented to provide an all in one package and provide server owners with the tools that they need to administrate their servers. The advantage is that it is built within the binaries, tailored for HL2MP and loads fast and does not come with any useless features. If you are coming from Sourcemod, a lot of the new system is built around familiarity so that if you wish to make the transition, you will not feel lost.
Admin Commands & Levels
Admin Commands
To use an admin command, you must follow the following syntax:
If you use the console to input commands, you must always prepend sa before the command: sa map dm_lockdown
If you use the chat to input commands, you do not need sa at all: !map dm_lockdown
Additionally, you can silence chat commands by using a forward slash: /map dm_lockdown
It also supports reply sources. If you type a command in the chat, it will reply in the chat, if you use the console (player or srcds server console), it will reply in those.
name
#userid
status
command in the console to retrieve a player's ID. The#
symbol is required.@all
@me
@blue
@red
@!me
@alive
@dead
@bots
@humans
Below is a table listing all available commands. Please note that non-root admins may only see commands they have access to.
say
<message>
j
)csay
<message>
j
)psay
<name|#userID> <message>
j
)chat
<message>
j
)ban
<name|#userID> <time> [reason]
d
)kick
<name|#userID> [reason]
c
)addban
<time> <SteamID3> [reason]
m
)banned_user.cfg
unban
<SteamID3>
e
)banned_user.cfg
slap
<name|#userID> [amount]
f
)slay
<name|#userID>
f
)noclip
<name|#userID>
f
)team
<name|#userID> <team index>
f
)gag
<name|#userID>
j
)ungag
<name|#userID>
j
)mute
<name|#userID>
j
)unmute
<name|#userID>
j
)bring
<name|#userID>
f
)goto
<name|#userID>
f
)map
<map name>
g
)cvar
<cvar name> [new value]
h
)exec
<filename>
i
)rcon
<command> [value]
m
)reloadadmins
i
)help
b
)version
b
)Admin Levels
Different commands require different levels. It is up to the server owner to define what an admin has access to.
There is no notion of immunity. It is expected and assumed that selected admins are fit for the job they were assigned. Only root admins are protected from being kicked, banned, gagged and muted.
Finally, there is no admin menus available. After surveying a number of people, it is clear the admin menu has absolutely no use and therefore was not included.
Adding Admins
Adding admins is straightforward. All admin data is handled in a single file called admins.txt. Navigate to
hl2mp\cfg\admin
and openadmins.txt
. This file also includes instructions on adding admins in case you need a reminder. At the bottom of the file, use the KeyValues format to add your admins:Example:
Admin data loads on every level initialization. You can also use
sa reloadadmins
to manually refresh the admin cache.Admin Logs
Admin Logs
All admin commands are logged in the
hl2mp\cfg\admin\logs
directory. Admin log files are prefixed withadminlogs_
, followed by the current date. Each log entry is formatted as follows:Example: