Raised This Month: $ Target: $400
 0% 

Uninamer (Unicode name changer)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Plugin ID:
252
Plugin Version:
1.2
Plugin Category:
Server Management
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    rename/kick players who abusively use unicode names
    Old 01-10-2008 , 21:58   Re: Uninamer (Unicode name changer)
    Reply With Quote #1

    PrintToConsole(0, "") will error won't it?

    Or does it just print to server console? You should look at PrintToServer()
    Greyscale is offline
    pRED*
    Join Date: Dec 2006
    Old 01-11-2008 , 00:29   Re: Uninamer (Unicode name changer)
    Reply With Quote #2

    There's no point in looping the full length of the string.

    The last character of the name will be followed by a null terminator which has the integer value 0 or char value '\0'

    So you can loop

    Code:
    while (num = nameBuf[i++])
    {
    		if (num>160)
    		{
    			uni=true;
    		}
    }
    or similar.
    pRED* is offline
    red!
    Senior Member
    Join Date: Sep 2007
    Location: Germany
    Old 01-11-2008 , 18:37   Re: Uninamer (Unicode name changer)
    Reply With Quote #3

    Quote:
    Originally Posted by pRED* View Post
    There's no point in looping the full length of the string.

    The last character of the name will be followed by a null terminator which has the integer value 0 or char value '\0'

    So you can loop

    Code:
    while (num = nameBuf[i++])
    {
            if (num>160)
            {
                uni=true;
            }
    }
    or similar.
    thats not a real performance issue thus linear memory access is not that expensive. but i'll look for that. i am planing a next version which is somehow more advanced in its behavior which will include a check for the string terminator. this first pre-release was just something like a feasibility study.
    red! is offline
    red!
    Senior Member
    Join Date: Sep 2007
    Location: Germany
    Old 01-13-2008 , 07:58   Re: Uninamer (Unicode name changer)
    Reply With Quote #4

    Quote:
    Originally Posted by Greyscale View Post
    PrintToConsole(0, "") will error won't it?

    Or does it just print to server console? You should look at PrintToServer()
    it's the server console. but you're right PrintToServer does the same. I'll replace this for better readability of the code.
    red! is offline
    J@y-R
    Senior Member
    Join Date: Jan 2007
    Location: Hamburg (Germany)
    Old 04-26-2008 , 09:47   Re: Uninamer (Unicode name changer)
    Reply With Quote #5

    A Kick function had nice

    Greetz
    JaY
    J@y-R is offline
    Send a message via ICQ to J@y-R Send a message via MSN to J@y-R
    sfPlayer
    Senior Member
    Join Date: Dec 2007
    Location: Germany
    Old 04-26-2008 , 11:20   Re: Uninamer (Unicode name changer)
    Reply With Quote #6

    you are comparing individual characters in an utf-8 encoded string and not real unicode values.

    I hacked something together to convert it properly, but it's untested.
    PHP Code:
    nameCheck(clientSlot) { 
        
    decl String:nameBuf[128];
         
        if (
    GetClientName(clientSlotnameBufsizeof(nameBuf))) { 
            new 
    badcharcount=0;
             
            for (new 
    i=0nameBuf[i]; i++) {
                
    decl ucValue;
                new 
    cc nameBuf[i];
                if (
    cc 1<<7) {
                    if (
    cc 1<<6) { // 2|3|4 byte
                        
    if (cc 1<<5) { // 3|4 byte
                            
    if (cc 1<<4) { // 4 byte
                                
    ucValue cc & (1<<1);
                                
                                for (new 
    n=0n<3n++) {
                                    
    i++;
                                    
    cc nameBuf[i];
                                    if ((
    cc 192) == 128) {
                                        
    ucValue = (ucValue<<6) | (cc & (1<<1));
                                    } else {
                                        
    LogError("invalid utf-8 sequence");
                                        return;
                                    }
                                }
                            } else { 
    // 3 byte
                                
    ucValue cc & (1<<1);
                                
                                for (new 
    n=0n<2n++) {
                                    
    i++;
                                    
    cc nameBuf[i];
                                    if ((
    cc 192) == 128) {
                                        
    ucValue = (ucValue<<6) | (cc & (1<<1));
                                    } else {
                                        
    LogError("invalid utf-8 sequence");
                                        return;
                                    }
                                }
                            }
                        } else { 
    // 2 byte
                            
    ucValue cc & (1<<1);
                            
                            
    i++;
                            
    cc nameBuf[i];
                            if ((
    cc 192) == 128) {
                                
    ucValue = (ucValue<<6) | (cc & (1<<1));
                            } else {
                                
    LogError("invalid utf-8 sequence");
                                return;
                            }
                        }
                    } else {
                        
    LogError("invalid utf-8 sequence");
                        return;
                    }
                } else {
                    
    ucValue cc;
                }
                 
                if (
    ucValue s_characterThreshold) { 
                    
    badcharcount++; 
                } 
            } 
            if (
    badcharcount s_maxBadChars) {     
                
    PrintToServer("[Uninamer] renaming %s (bad chars: %d>%d)"nameBufbadcharcounts_maxBadChars); 
                
    LogMessage("renaming %s (bad chars: %d>%d)"nameBufbadcharcounts_maxBadChars); 
                
    GetConVarString(s_defaultNamenameBuf128); 
                
    ClientCommand(clientSlot"name \"%s\""nameBuf); 
            } 
        } 

    sfPlayer is offline
    red!
    Senior Member
    Join Date: Sep 2007
    Location: Germany
    Old 04-26-2008 , 16:49   Re: Uninamer (Unicode name changer)
    Reply With Quote #7

    Quote:
    Originally Posted by J@y-R View Post
    A Kick function had nice

    Greetz
    JaY
    yes, could do this.

    this plugin was a quick hack and deserves closer attention. A kick-feature is a reasonable option for this plugin. and revising the unicode name handling will also be of interest. unfortunately I was a bit short on time the last days ... (changed occupation, moved to a new place, and I am still fighting nature - and my 10 weeks old dog - to get the damned garden to an eligible condition)
    red! is offline
    Zuko
    SourceMod Donor
    Join Date: Sep 2006
    Location: Poland
    Old 08-04-2008 , 13:29   Re: Uninamer (Unicode name changer)
    Reply With Quote #8

    polish translation / polskie tłumaczenie
    Attached Files
    File Type: txt uninamer.phrases.txt (246 Bytes, 312 views)
    __________________
    Zuko is offline
    Send a message via ICQ to Zuko
    Chaos Llama
    Senior Member
    Join Date: Jul 2006
    Old 08-11-2008 , 02:21   Re: Uninamer (Unicode name changer)
    Reply With Quote #9

    A whitelist by steamid or clan tag would be really cool.
    Chaos Llama is offline
    Hollanda
    Senior Member
    Join Date: Sep 2006
    Location: Netherlands
    Old 10-29-2008 , 20:36   Re: Uninamer (Unicode name changer)
    Reply With Quote #10

    Would it be possible to change the plugin so you can set a minimum number of normal unicode signs?

    Explanation: I dont mind people playing with unicode signs, but I do mind them not playing with any normal signs, so I can not kick/slay/slap/check rates them.
    Hollanda 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 08:08.


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