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_plugin( PLUGIN, VERSION, AUTHOR ); }
public client_putinserver(id) CheckName(id, true);
public client_infochanged(id) CheckName(id, false);
public CheckName( id, bool:bShowMsg ) { static i, j, szName[33], szNewName[33], len; i = j = len = 0; szName[0] = '^0'; szNewName[0] = '^0'; get_user_info(id, "name", szName, 33); len = strlen(szName); // log_amx( "Checking.... %s[%d] ", szName, len ); for( i = 0; i < len; i++ ) { 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( j < 33 ) szNewName[j] = '^0'; set_user_info(id,"name",szNewName); if( bShowMsg ) { client_print( 0, print_chat, "Player with original nickname ^"%s^"[%s] joined the game.", szName, szNewName ); } }
How can I include some symbols like "@" "*" "<" ">" to be accepted?
|