Set My Name
Ever wanted to change your name to something else just like before the Orange box update in 2010? Now, you can!
This plugin will allow any player to change their in-game name on the server they are connected to as many times as they want without having to go on Steam and change their name.
You can reset to your actual Steam name at any time!
For players, they only have to remember two command:
sm_name <new name> (leave blank to reset to name on server connection)
sm_oname <#userid|name> - Find the original name of a user upon connection if he changed it during his stay on the server
sm_nhelp - Display commands available for you to use (console print)
sm_sname - Display the current Steam name of a user
!srname - Reset to current Steam name of user (chat only command)
sm_name_version - Duh
sm_name_help_enable 0/1 (default 1)
sm_name_enable 0/1 (default 1)
sm_cname_enable 0/1 (default 1)
sm_oname_enable 0/1 (default 1)
sm_sname_enable 0/1 (default 1)
sm_srname_enable 0/1 (default 1)
sm_name_debug 0/1 (default 0)
sm_name_debug_snd 0/1 (default 1)
sm_name_debug_snd_on <path> (default hl1/fvox/bell.wav)
sm_name_debug_snd_off <path> (default hl1/fvox/beep.wav)
Simply download the zip below and extract its content in the root of the mod folder like C:\srcds\hl2mp or whatever game you have a server on.
Note: For the plugin to work properly, you will need to have every player re-connect in order for their SteamID to be read and stored. The plugin will not work properly if you drop the plugin in your plugins folder, refresh the plugins list and try to change your name since the plugin did not store SteamIDs upon connection. Simply restart the server or refresh your plugins list and reload the map.
Couple things that could be done:
- Block certain names from being used
Enable/Disable the plugin
- Prevent one or more players from using the command sm_name after an admin renamed them
Adding a public command to target a player to know what their actual Steam name is
- Block default name change messages
Make checks whether the new name is identical to the current name
- Punishment system for using inappropriate names
- Limit how many times a user can change his name within a time frame
- Provide the name history (printed to your console) //Maybe the last 10 names used (TBD)
The plugin is really simple, meaning that its base function is to change your name in-game and/or switch back to your Steam name. It nows checks whether the new name you are trying to put is identical to the current name. The source code is available, so if you want to edit it, you can.
For admins: If you rename another player, said player can change back his name with ease, so if you want to prevent a user from changing his name again, then this plugin will need an edit.
Updating and recompiling
If you plan on editing and recompiling the plugin, the only file you are going to need in addition to the provided files by Sourcemod is morecolors.inc
I apologize to advanced Sourcemod coders if the code looks messy or unprofessional. Like I said in my first plugin post, I am still quite new to all of this.
Lastly, I have not seen any other plugins do this, so I apologize in advance if this was done before.
1) New ConVars:
[NEW] sm_name_enable 0/1 -> Controls whether the plugin should be enabled or disabled
[NEW] sm_cname_enable 0/1 -> Controls whether players can change their name
[NEW] sm_oname_enable 0/1 -> Controls whether players can check original name of players
[NEW] sm_sname_enable 0/1 -> Controls whether players can check Steam name of players
[NEW] sm_srname_enable 0/1 -> Controls whether players can reset to their Steam name
A timer will check every 15 seconds if values for sm_cname_enable, sm_oname_enable and sm_sname_enable (and/or sm_name_enable) are set to 0. If they are, the plugin will automatically set values for sm_cname_enable, sm_oname_enable and sm_sname_enable to 1 and sm_name_enable to 0. This is hard-coded, though, and cannot be changed yet.
[NEW] sm_name_debug 0/1 -> Toggles logging for debugging purposes (Only use this if you are experiencing weird issues)
[NEW] sm_name_debug_snd 0/1 -> Sets whether to play a sound when debug mode is toggle on or off
[NEW] sm_name_debug_snd_on <sound file> (starts from the "sound" folder and you do not need to include "sound/"; make sure you put forward slashes "/")
[NEW] sm_name_debug_snd_off <sound file> (starts from the "sound" folder and you do not need to include "sound/"; make sure you put forward slashes "/")
The debugger can be activated with sm_name_debug 0/1. Its purpose is to log every command executed by players in a file called NameChanger.log that you can find in sourcemod/logs/NameChanger folder. If you are in-game, those messages will appear in gray. To avoid your log folder from using too much space, the command sm_name_debug is set to turn off automatically when the map ends.
2) Code revisited
[REVISION] *sm_oname <#userid|name> now fetches the name upon connection to the server and stores until you reconnect
[NEW] *sm_sname <#userid|name> is a new public command that will properly fetch the Steam name
[NEW] *!srname will properly reset your name to your Steam name
3) Translation files
[NEW] New translations created.
[NEW] Plugin customization with name.plugin.cfg in sourcemod/cfg
5) Other less important changes
If you use the plugin in another game than Half-Life 2: Deathmatch, a warning will let you know that it is untested in other games.
If you are using another name plugin, this plugin will halt and throw an error letting you know you cannot run two name plugins at once.
- Fixed an issue with sm_oname where only admins could use it and would report unknown command to regular players
- Blocked default name change messages shown by the game
- Added the base code author in the plugin's name
- The plugin now checks whether the name you are trying to input is identical to your current name
- Made name changes print to everyone (the default name change message from the engine is not blocked, but this is a simple fix)
- Added sm_oname <#userid|name> which will print the Steam name of the user you are targeting at
Initial release of plugin Set My Name
A special thanks to Harper for helping get this done.