Raised This Month: $12 Target: $400
 3% 

[Any] Remove spêcific characters ont player's name


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
B!PP
Member
Join Date: Sep 2009
Old 07-01-2011 , 05:10   [Any] Remove spêcific characters ont player's name
Reply With Quote #1

Hi everyone.

I'm seeking a plugin who can remove specific characters on the player's name.
the problem is those MW2 players coming en TF2, and having names like so :
Quote:
^9B^3E^1W^9|^9Al^3bat^1or*
The plugin would remove any "^" characters, and the number next to it (Like "^9")

So the real name would appear :
Quote:
BEW|Albator*
See?

I've seeked a plugin like this on the forum, cound't find one

Thanks for any help !
B!PP is offline
Groger
Veteran Member
Join Date: Oct 2009
Location: Belgium
Old 07-01-2011 , 09:29   Re: [Any] Remove spêcific characters ont player's name
Reply With Quote #2

http://forums.alliedmods.net/showthread.php?p=1269003
Groger is offline
B!PP
Member
Join Date: Sep 2009
Old 07-01-2011 , 14:30   Re: [Any] Remove spêcific characters ont player's name
Reply With Quote #3

That would be cool, but I want to RENAME the players, not to color them

I want to rename them so the odds characters will disappear.

^9B^3E^1W^9|^9Al^3bat^1or* -> BEW|Albator*
B!PP is offline
Groger
Veteran Member
Join Date: Oct 2009
Location: Belgium
Old 07-01-2011 , 14:35   Re: [Any] Remove spêcific characters ont player's name
Reply With Quote #4

it does that + coloring. I'm not sure if you can disable that color effect.
Groger is offline
B!PP
Member
Join Date: Sep 2009
Old 07-01-2011 , 19:03   Re: [Any] Remove spêcific characters ont player's name
Reply With Quote #5

Yeah, I've looked at the sourcecode, and I need something like

Quote:
ReplaceString(name, sizeof(name), "^0", "");
ReplaceString(name, sizeof(name), "^1", "");
ReplaceString(name, sizeof(name), "^2", "");
ReplaceString(name, sizeof(name), "^3", "");
ReplaceString(name, sizeof(name), "^4", "");
ReplaceString(name, sizeof(name), "^5", "");
ReplaceString(name, sizeof(name), "^6", "");
ReplaceString(name, sizeof(name), "^7", "");
ReplaceString(name, sizeof(name), "^8", "");
ReplaceString(name, sizeof(name), "^9", "");
I guess it's quite simple to do, but I've never created a plugin.
B!PP is offline
B!PP
Member
Join Date: Sep 2009
Old 07-01-2011 , 20:39   Re: [Any] Remove spêcific characters ont player's name
Reply With Quote #6

Well... I've just made an ulgy part of code, based on two different plugins.
I did not founded any sub-categories to help me to code this.

I think a skilled coder will "understand" my code and my intentions.


Code:
#include <sourcemod>
#include <sdktools>
#define AUTOLOAD_EXTENSIONS
#define REQUIRE_EXTENSIONS

#define PLUGIN_VERSION "0.0.1"

public Plugin:myinfo = {
    name        = "[TF2] MW2Renamer",
    author      = "SqTH",
    description = "Automatically remove colors characters of MW2 players. Based on [TF2] Free2BeRenamed by DarthNinja, and Colored Names by Thraka (Original by Afronanny)",
    version     = PLUGIN_VERSION
};

//Execute itself on client connect ?
public OnClientPostAdminCheck(client)
{    
  //exclude bots ?
    if (IsFakeClient(client))
    {
        return;
    }
    
    
     //create strings
    decl String:NewName[MAX_NAME_LENGTH];
    decl String:Name[MAX_NAME_LENGTH];
    
    //take name's player ?
      GetEventString(event, "newname", Name, sizeof(Name));
    
    //replaces characters ?
    ReplaceString(name, sizeof(name), "^0", "");
    ReplaceString(name, sizeof(name), "^1", "");
    ReplaceString(name, sizeof(name), "^2", "");
    ReplaceString(name, sizeof(name), "^3", "");
    ReplaceString(name, sizeof(name), "^4", "");
    ReplaceString(name, sizeof(name), "^5", "");
    ReplaceString(name, sizeof(name), "^6", "");
    ReplaceString(name, sizeof(name), "^7", "");
    ReplaceString(name, sizeof(name), "^8", "");
    ReplaceString(name, sizeof(name), "^9", ""); 


        //update name ? Dont think is needed with "replace string, but got to have something to send new name ?"
        SetClientInfo(client, "name", NewName);            

    //?? :s
    return;
}
Can someone help me to make this compile ?
B!PP is offline
B!PP
Member
Join Date: Sep 2009
Old 07-01-2011 , 21:09   Re: [Any] Remove spêcific characters ont player's name
Reply With Quote #7

IT WORKS !

[TF2] MW2Renamer

Last edited by B!PP; 07-01-2011 at 21:44.
B!PP is offline
Reply



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:24.


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