AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Only specific characters on nickname (https://forums.alliedmods.net/showthread.php?t=264579)

flaxo 06-19-2015 09:33

Only specific characters on nickname
 
Hello community.

Is there any plugin or module that allows only specific characters on player nicknames? For example, I would like to allow only nicknames with letters (a-z) and numbers (0-9). Otherwise, the player should be kicked on connect with a specific reason about nickname limitations. Is this possible to be done?

Thanks in advance

Edit: I found this
PHP Code:

#include <amxmodx>

#define PLUGIN        "No-Spl Chars InName"
#define VERSION        "1.0"
#define AUTHOR        "Shooting King"


public plugin_init()
{
    
register_pluginPLUGINVERSIONAUTHOR );
}

public 
client_putinserver(idCheckName(idtrue);

public 
client_infochanged(idCheckName(idfalse);

public 
CheckNameidbool:bShowMsg )
{
    static 
ijszName[33], szNewName[33], len;
    
    
len 0;
    
szName[0] = '^0';
    
szNewName[0] = '^0';
    
    
get_user_info(id"name"szName33);
    
len strlen(szName);
    
// log_amx( "Checking.... %s[%d] ", szName, len );
    
    
for( 0leni++ )
    {
        if( (
szName[i] > 47 &&  szName[i] < 58) ||  // Numbers from 1, 2, ...., 0
            
(szName[i] > 64 &&  szName[i] < 91) ||    // Chars from A, B, C, ...., Z
            
(szName[i] > 96 &&  szName[i] < 123) || // Chars from a, b, c, ...., z
            
(szName[i] == ' ') )
        {
            
// log_amx( "a Valid Char.... %c[%d] ", szName[i], i );
            
szNewName[j] = szName[i];
            
j++;
        }
        else
        {
            
// log_amx( "Not a Valid Char.... %c[%d] ", szName[i], i );
            
continue;
        }
    }
    
    if( 
33 szNewName[j] = '^0';    
    
set_user_info(id,"name",szNewName); 
    
    if( 
bShowMsg )
    {
        
client_print0print_chat"Player with original nickname ^"%s^"[%s] joined the game."szNameszNewName );
    }


How can I include some symbols like "@" "*" "<" ">" to be accepted?

fysiks 06-19-2015 23:52

Re: Only specific characters on nickname
 
Use the "Restrict Names" plugin with the regex pattern: [^a-z0-9A-Z\*@<>]+


All times are GMT -4. The time now is 20:13.

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