Raised This Month: $68 Target: $400
 17% 

[HL2DM|ANY?] - Set My Name


Post New Thread Reply   
 
Thread Tools Display Modes
Author
speedvoltage
Junior Member
Join Date: Jul 2017
Plugin ID:
6131
Plugin Version:
1.3.0.0
Plugin Category:
Fun Stuff
Plugin Game:
Half-Life 2 Deathmatch
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    A plugin that allows you to change your name in-game without effecting your Steam name
    Old 05-19-2018 , 16:31   [HL2DM|ANY?] - Set My Name
    Reply With Quote #1

    Set My Name

    Introduction

    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!

    Commands

    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)

    ConVars

    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)


    Installation

    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.

    Suggestion List


    Couple things that could be done:
    1. Block certain names from being used
    2. Enable/Disable the plugin
    3. Prevent one or more players from using the command sm_name after an admin renamed them
    4. Adding a public command to target a player to know what their actual Steam name is
    5. Block default name change messages
    6. Make checks whether the new name is identical to the current name
    7. Punishment system for using inappropriate names
    8. Limit how many times a user can change his name within a time frame
    9. Provide the name history (printed to your console) //Maybe the last 10 names used (TBD)

    Additional Notes

    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.

    Version History

    Quote:
    Version 1.3.0.0
    Changelog:

    1) New ConVars:

    //General 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.

    //Technical ConVars
    [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.

    4) Customization

    [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.

    Quote:
    Version 1.2.0.0
    Changelog:
    • 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
    Quote:
    Version 1.1.0.0
    Changelog:
    • 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
    Quote:
    Version 1.0.0.0
    Initial release of plugin Set My Name
    Special Thanks

    A special thanks to Harper for helping get this done.
    Attached Files
    File Type: zip setmyname.zip (30.3 KB, 32 views)

    Last edited by speedvoltage; 09-10-2018 at 20:02.
    speedvoltage is offline
    Lannister
    Veteran Member
    Join Date: Apr 2015
    Old 05-19-2018 , 16:37   Re: [ANY] - Set My Name
    Reply With Quote #2

    Interesting idea, good work for doing this.

    Quote:
    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.
    This seems like a really good feacture, always thought that setting a name to a player is a interesting idea, useful for gamemodes like Jailbreak were people uses names with symbols or shit like that and it's impossible to "call them" for their name. I'm really looking foward this.

    Good job!
    Lannister is offline
    ThatKidWhoGames
    Veteran Member
    Join Date: Jun 2013
    Location: IsValidClient()
    Old 05-21-2018 , 13:48   Re: [ANY] - Set My Name
    Reply With Quote #3

    Awesome plugin!
    ThatKidWhoGames is offline
    speedvoltage
    Junior Member
    Join Date: Jul 2017
    Old 06-08-2018 , 17:36   Re: [ANY] - Set My Name
    Reply With Quote #4

    Plugin updated to version 1.1.0.0. Changelog above.
    speedvoltage is offline
    eyal282
    Veteran Member
    Join Date: Aug 2011
    Old 06-09-2018 , 06:26   Re: [ANY] - Set My Name
    Reply With Quote #5

    If you change your steam name after you're inside, it doesn't save it. Also I am using a form of "Simple Chat Processor" and I believe your plugin not only encounters with my chat processor but also with all online chat processors. Here's my plugin, only allows to !name but also allows you to set the name you will connect with, if you are an admin and want to hide . If you want to set your connecting name to "Epic Guy", you need to write this in console:

    setinfo secretname "Epic Guy"

    If you don't use the quotes, it will only set it to Epic.

    Code:
    #include <sourcemod>
    #include <sdktools_functions>
    
    public Plugin:myinfo = 
    {
    	name = "sm_name",
    	author = "Eyal282 ( FuckTheSchool )",
    	description = "Players can now change name with !name",
    	version = "1.0",
    	url = "N/A"
    }
    
    public OnPluginStart()
    {
    	RegConsoleCmd("sm_name", Command_Name, "Changes your name without setinfo name \"New Name\"");
    }
    
    public Action:Command_Name(client, args)
    {
    	if(args <= 0)
    	{
    		ReplyToCommand(client, "[SM] Usage: sm_name <new name>");
    		return Plugin_Handled;
    	}
    	
    	new String:ArgString[64];
    	GetCmdArgString(ArgString, sizeof(ArgString));
    	
    	// Due to a chat bug, a single frame delay is needed.
    	new Handle:DP = CreateDataPack();
    	
    	RequestFrame(TwoTotalFrames, DP);
    	
    	WritePackCell(DP, GetClientUserId(client));
    	WritePackString(DP, ArgString);
    	
    	return Plugin_Handled;
    }
    
    public OnClientAuthorized(client)
    {
    	new String:PermaName[50];
    	
    	
    	if(!GetClientInfo(client, "secretname", PermaName, sizeof(PermaName)))
    		return;
    	
    	else if(PermaName[0] == EOS)	
    		return;
    	
    	for(new i=1;i <= MaxClients;i++)
    	{	
    		if(!IsClientInGame(i))
    			continue;
    		
    		else if(IsFakeClient(i))
    			continue;
    			
    		else if(!CheckCommandAccess(i, "sm_kick", ADMFLAG_KICK))
    			continue;
    		
    		PrintToChat(i, "\x03Client\x04 %N\x01 has joined with the name\x05 %s.", client, PermaName);
    	}
    	
    	SetClientInfo(client, "name", PermaName);
    	
    }
    
    public TwoTotalFrames(Handle:DP)
    {
    	RequestFrame(ChangeName, DP);
    }
    public ChangeName(Handle:DP)
    {
    	ResetPack(DP);
    	
    	new client = GetClientOfUserId(ReadPackCell(DP));
    	
    	if(client <= 0 || client > MaxClients)
    		return;
    		
    	else if(!IsClientInGame(client))
    		return;
    
    	new String:NewName[64];
    	ReadPackString(DP, NewName, sizeof(NewName));
    	
    	CloseHandle(DP);
    	
    	SetClientInfo(client, "name", NewName);
    }
    __________________
    Accepting private work. Contact me if you're interested.
    If you like my work, feel free to donate in appreciation with PayPal or CSGO Skins.

    Total Donated: 10$
    eyal282 is offline
    speedvoltage
    Junior Member
    Join Date: Jul 2017
    Old 06-09-2018 , 09:23   Re: [ANY] - Set My Name
    Reply With Quote #6

    I have updated the plugin to fix a small issue with sm_oname and blocked the default name change messages from the game.

    Eyal282, I appreciate the time you have taken to reply. I was unaware it caused some kind of conflict with other plugins. I work with HL2DM in mind and I do not test the plugin in other games. I will look at your code here and update mine accordingly.
    speedvoltage is offline
    eyal282
    Veteran Member
    Join Date: Aug 2011
    Old 06-09-2018 , 10:34   Re: [ANY] - Set My Name
    Reply With Quote #7

    Quote:
    Originally Posted by speedvoltage View Post
    I have updated the plugin to fix a small issue with sm_oname and blocked the default name change messages from the game.

    Eyal282, I appreciate the time you have taken to reply. I was unaware it caused some kind of conflict with other plugins. I work with HL2DM in mind and I do not test the plugin in other games. I will look at your code here and update mine accordingly.
    The conflict is annoying although minor: if you don't wait 2 frames from the function, if !name is used and not /name or sm_name, then the player's name will appear gray ( spectator ) even if he is ct ( or survivor ) or terrorist ( or infected )

    I am going to add such functionality and I will upload a different plugin for all to use.
    __________________
    Accepting private work. Contact me if you're interested.
    If you like my work, feel free to donate in appreciation with PayPal or CSGO Skins.

    Total Donated: 10$
    eyal282 is offline
    speedvoltage
    Junior Member
    Join Date: Jul 2017
    Old 06-09-2018 , 11:19   Re: [ANY] - Set My Name
    Reply With Quote #8

    If you are going to upload your version, you are more than welcome, but I have features I need to add. You can find those features in the first post.
    speedvoltage is offline
    eyal282
    Veteran Member
    Join Date: Aug 2011
    Old 06-09-2018 , 12:51   Re: [ANY] - Set My Name
    Reply With Quote #9

    Quote:
    Originally Posted by speedvoltage View Post
    If you are going to upload your version, you are more than welcome, but I have features I need to add. You can find those features in the first post.
    Mind if I copy some of your useful features?
    __________________
    Accepting private work. Contact me if you're interested.
    If you like my work, feel free to donate in appreciation with PayPal or CSGO Skins.

    Total Donated: 10$
    eyal282 is offline
    speedvoltage
    Junior Member
    Join Date: Jul 2017
    Old 06-09-2018 , 12:58   Re: [ANY] - Set My Name
    Reply With Quote #10

    You are welcome to implement them. I will implement them in mine anyway.
    speedvoltage is offline
    Reply


    Thread Tools
    Display Modes

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 14:51.


    Powered by vBulletin®
    Copyright ©2000 - 2019, vBulletin Solutions, Inc.
    Theme made by Freecode