Color Code Cleanup
2 Attachment(s)
I got sick and tired of seeing the stupid color codes (those ^# things) for COD in names in TF2.
Thus, this plugin. Has one setting: sm_colorcodecleanup_threshold Defaults to 1, as in 1 color code allowed in the name. Set to 0 to strip a name of color codes no matter what. I left it at one because I could see someone trying to make a face or something in their name using ^ followed by a number, like 0 or 8. Tested in a limited fashion. It calls the sm_rename command (which should be part of playercommands, alongside slap and slay) for the client, as I didn't want to copy/paste/have to keep updating that code. It should work in any game that sm_rename does. If someone has all color codes for a name for some reason it will name them Unnamed. EDIT: Version 0.2, should be a bit of an efficiency improvement on figuring out the new name, and throws an activity line in. EDIT: Version 0.3, use the player_changename event instead of OnClientSettingsChanged (Benefit of it only fires when the name changes, compared to on #Name_change_limit_exceeded and other minor changes), but still has timers (INTENTIONALLY, FOR GOOD REASON, SEE POST A COUPLE DOWN) |
Re: Color Code Cleanup
Why did u use timers and OnClientSettingsChanged()? OnClientSettingsChanged() happens like 100 times in second. Its better to check player name in OnClientConnected() and hook "player_changename" event to prevent changing name after connect.
|
Re: Color Code Cleanup
As for using OnClientSettingsChanged, it was pretty much only firing when a name changed (almost) and for whatever reason I am missing some events in my local listing of events.
As for not blocking the name change event, I don't think that actually blocks changing the name to begin with. If it does, I don't WANT to keep them from changing their name. (I have keybinds to change mine!) As for timers..... Code:
Did update the plugin to use the event though. |
Re: Color Code Cleanup
Omg. I incorrectly wrote.
U dont need to block namechange in event "player_changename", just check new name for color codes. If name contains color codes and u want to change it then create timer which will change name. |
Re: Color Code Cleanup
Quote:
|
Re: Color Code Cleanup
Nvm. I just wanted to clarify about the #2 post, and didnt even look at 3rd version :-)
|
Re: Color Code Cleanup
tried this in L4D2, its not working for me.
|
Re: Color Code Cleanup
Quote:
|
Re: Color Code Cleanup
It's Linux.
|
Re: Color Code Cleanup
Quote:
|
All times are GMT -4. The time now is 07:53. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.