Monthly Target: $400 Donations: $147
 36% 

Color Code Cleanup


Post New Thread Reply   
 
Thread Tools Display Modes
Author
cmptrwz
Member
Join Date: Dec 2008
Plugin ID:
1522
Plugin Version:
0.3
Plugin Category:
Server Management
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    6 
    Plugin Description:
    Remove Quake/COD style color codes from names
    Old 03-13-2010 , 23:11   Color Code Cleanup
    Reply With Quote #1

    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)
    Attached Files
    File Type: sp Get Plugin or Get Source (colorcodecleanup.sp - 982 views - 3.7 KB)

    Last edited by cmptrwz; 03-16-2010 at 17:33.
    cmptrwz is offline
    krolus
    Senior Member
    Join Date: May 2009
    Location: Russia, Omsk
    Old 03-16-2010 , 01:29   Re: Color Code Cleanup
    Reply With Quote #2

    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.
    __________________
    kAmmomod is deprecated. Take a look at MGE Training

    Last edited by krolus; 03-16-2010 at 01:31.
    krolus is offline
    cmptrwz
    Member
    Join Date: Dec 2008
    Old 03-16-2010 , 17:34   Re: Color Code Cleanup
    Reply With Quote #3

    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:
    ] setinfo name a
    ] setinfo name b
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    #Name_change_limit_exceeded
    THAT is why I have timers.

    Did update the plugin to use the event though.
    cmptrwz is offline
    krolus
    Senior Member
    Join Date: May 2009
    Location: Russia, Omsk
    Old 03-17-2010 , 01:34   Re: Color Code Cleanup
    Reply With Quote #4

    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.
    __________________
    kAmmomod is deprecated. Take a look at MGE Training

    Last edited by krolus; 03-17-2010 at 01:39.
    krolus is offline
    cmptrwz
    Member
    Join Date: Dec 2008
    Old 03-17-2010 , 10:50   Re: Color Code Cleanup
    Reply With Quote #5

    Quote:
    Originally Posted by krolus View Post
    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.
    If you looked at the latest update, I do believe I do that now. <_<
    cmptrwz is offline
    krolus
    Senior Member
    Join Date: May 2009
    Location: Russia, Omsk
    Old 03-18-2010 , 02:56   Re: Color Code Cleanup
    Reply With Quote #6

    Nvm. I just wanted to clarify about the #2 post, and didnt even look at 3rd version :-)
    __________________
    kAmmomod is deprecated. Take a look at MGE Training
    krolus is offline
    thejuice027
    Senior Member
    Join Date: Dec 2009
    Old 03-28-2010 , 23:06   Re: Color Code Cleanup
    Reply With Quote #7

    tried this in L4D2, its not working for me.
    __________________
    Steam_id: thejuice027
    thejuice027 is offline
    cmptrwz
    Member
    Join Date: Dec 2008
    Old 03-29-2010 , 12:50   Re: Color Code Cleanup
    Reply With Quote #8

    Quote:
    Originally Posted by thejuice027 View Post
    tried this in L4D2, its not working for me.
    Windows server or Linux server? If Windows, you need to update your gamedata, there is a bad offset (off by 1).
    cmptrwz is offline
    thejuice027
    Senior Member
    Join Date: Dec 2009
    Old 03-29-2010 , 17:15   Re: Color Code Cleanup
    Reply With Quote #9

    It's Linux.
    __________________
    Steam_id: thejuice027
    thejuice027 is offline
    cmptrwz
    Member
    Join Date: Dec 2008
    Old 03-29-2010 , 18:14   Re: Color Code Cleanup
    Reply With Quote #10

    Quote:
    Originally Posted by thejuice027 View Post
    It's Linux.
    You getting any log errors? Does sm_rename work?
    cmptrwz 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 09:42.


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