Raised This Month: $ Target: $400
 0% 

Only specific characters on nickname


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
flaxo
Member
Join Date: Nov 2013
Old 06-19-2015 , 09:33   Only specific characters on nickname
Reply With Quote #1

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?
__________________
FastDL hosting for FREE. Just drop me a PM ;)

Last edited by flaxo; 06-19-2015 at 09:41.
flaxo is offline
 



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 20:13.


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