#include <amxmodx>
#include <fakemeta>
#define PLUGIN "CS Revo: Clear Name"
#define VERSION "1.0"
#define AUTHOR "Wilian M."
new const xSymbols[][] =
{
"!",
"/",
"*",
"+",
"#",
"|",
"~",
"$",
"?",
"^^",
"'",
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_forward(FM_ClientUserInfoChanged, "xClientUserInfoChanged", false)
}
public client_putinserver(id) xClearName(id);
public xClientUserInfoChanged(id)
{
if(!is_user_connected(id))
return FMRES_IGNORED
static xUserName[32]
pev(id, pev_netname, xUserName, charsmax(xUserName))
if(xUserName[0])
{
static name[] = "name"
static xUserNewName[32]
get_user_info(id, name, xUserNewName, charsmax(xUserNewName))
if(!equal(xUserName, xUserNewName))
{
xClearName(id)
return FMRES_HANDLED
}
}
return FMRES_IGNORED
}
public xClearName(id)
{
new i, replace, name[32]; get_user_name(id, name, charsmax(name))
replace = 0
for(i = 0; i < sizeof(xSymbols); i++)
{
replace = replace_string(name, charsmax(name), xSymbols[i], "")
}
if(replace)
set_user_info(id, "name", name)
}
not workingI did it now, but I didn't test it, test it and tell me
PHP:#include <amxmodx> #include <fakemeta> #define PLUGIN "CS Revo: Clear Name" #define VERSION "1.0" #define AUTHOR "Wilian M." new const xSymbols[][] = { "!", "/", "*", "+", "#", "|", "~", "$", "?", "^^", "'", } public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_forward(FM_ClientUserInfoChanged, "xClientUserInfoChanged", false) } public client_putinserver(id) xClearName(id); public xClientUserInfoChanged(id) { if(!is_user_connected(id)) return FMRES_IGNORED static xUserName[32] pev(id, pev_netname, xUserName, charsmax(xUserName)) if(xUserName[0]) { static name[] = "name" static xUserNewName[32] get_user_info(id, name, xUserNewName, charsmax(xUserNewName)) if(!equal(xUserName, xUserNewName)) { xClearName(id) return FMRES_HANDLED } } return FMRES_IGNORED } public xClearName(id) { new i, replace, name[32]; get_user_name(id, name, charsmax(name)) replace = 0 for(i = 0; i < sizeof(xSymbols); i++) { replace = replace_string(name, charsmax(name), xSymbols[i], "") } if(replace) set_user_info(id, "name", name) }
not working
if you have another plugin that handles chat, leave this one first in 'plugins.ini'not working
#include <amxmodx>
#include <fakemeta>
#define PLUGIN "CS Revo: Clear Name"
#define VERSION "1.0"
#define AUTHOR "Wilian M."
new const xSymbols[][] =
{
"!",
"/",
"*",
"+",
"#",
"#",
"|",
"~",
"$",
"?",
"^^",
"'",
"%",
"%",
"-"
}
new xSayMessage[192], xUserNewName[32], xReplace
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_forward(FM_ClientUserInfoChanged, "xClientUserInfoChanged", false)
register_clcmd("say", "xCheckSay")
register_clcmd("say_team", "xCheckSay")
}
public client_connect(id)
{
if(xClearName(id))
return PLUGIN_CONTINUE
return PLUGIN_CONTINUE
}
public xCheckSay(id)
{
if(!is_user_connected(id))
return PLUGIN_HANDLED
read_args(xSayMessage, charsmax(xSayMessage))
remove_quotes(xSayMessage)
trim(xSayMessage)
static i, xFind
xFind = -1
for(i = 0; i < sizeof(xSymbols); i++)
{
if(contain(xSayMessage, xSymbols[i]) != -1)
xFind = true
if(xFind != -1)
break
}
if(xFind != -1)
{
client_print_color(id, print_team_default, "^4Special characters not allowed.")
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public xClientUserInfoChanged(id)
{
if(!is_user_connected(id))
return FMRES_IGNORED
static xUserName[32]
pev(id, pev_netname, xUserName, charsmax(xUserName))
if(xUserName[0])
{
get_user_info(id, "name", xUserNewName, charsmax(xUserNewName))
if(!equal(xUserName, xUserNewName))
{
if(xClearName(id))
return FMRES_HANDLED
}
}
return FMRES_IGNORED
}
public xClearName(id)
{
static i
get_user_info(id, "name", xUserNewName, charsmax(xUserNewName))
xReplace = 0
for(i = 0; i < sizeof(xSymbols); i++)
xReplace = replace_string(xUserNewName, charsmax(xUserNewName), xSymbols[i], "")
if(xReplace)
{
trim(xUserNewName)
set_user_info(id, "name", xUserNewName)
return true
}
return false
}
im not sure but its probably what you're looking for[1.1] SafeNameAndChat
Автор: Алексеич Metamod plugin, which replaces special characters in player names and chat messages.dev-cs.ru
This is not what I'm looking for unfortunately. I want to block ASCII characters in the list below. I also want to block arabic, russian, chinese, japanese characters.if you have another plugin that handles chat, leave this one first in 'plugins.ini'
check:
PHP:#include <amxmodx> #include <fakemeta> #define PLUGIN "CS Revo: Clear Name" #define VERSION "1.0" #define AUTHOR "Wilian M." new const xSymbols[][] = { "!", "/", "*", "+", "#", "#", "|", "~", "$", "?", "^^", "'", "%", "%", "-" } new xSayMessage[192], xUserNewName[32], xReplace public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_forward(FM_ClientUserInfoChanged, "xClientUserInfoChanged", false) register_clcmd("say", "xCheckSay") register_clcmd("say_team", "xCheckSay") } public client_connect(id) { if(xClearName(id)) return PLUGIN_CONTINUE return PLUGIN_CONTINUE } public xCheckSay(id) { if(!is_user_connected(id)) return PLUGIN_HANDLED read_args(xSayMessage, charsmax(xSayMessage)) remove_quotes(xSayMessage) trim(xSayMessage) static i, xFind xFind = -1 for(i = 0; i < sizeof(xSymbols); i++) { if(contain(xSayMessage, xSymbols[i]) != -1) xFind = true if(xFind != -1) break } if(xFind != -1) { client_print_color(id, print_team_default, "^4Special characters not allowed.") return PLUGIN_HANDLED } return PLUGIN_CONTINUE } public xClientUserInfoChanged(id) { if(!is_user_connected(id)) return FMRES_IGNORED static xUserName[32] pev(id, pev_netname, xUserName, charsmax(xUserName)) if(xUserName[0]) { get_user_info(id, "name", xUserNewName, charsmax(xUserNewName)) if(!equal(xUserName, xUserNewName)) { if(xClearName(id)) return FMRES_HANDLED } } return FMRES_IGNORED } public xClearName(id) { static i get_user_info(id, "name", xUserNewName, charsmax(xUserNewName)) xReplace = 0 for(i = 0; i < sizeof(xSymbols); i++) xReplace = replace_string(xUserNewName, charsmax(xUserNewName), xSymbols[i], "") if(xReplace) { trim(xUserNewName) set_user_info(id, "name", xUserNewName) return true } return false }
i think you should ask hereThis is not what I'm looking for unfortunately. I want to block ASCII characters in the list below. I also want to block arabic, russian, chinese, japanese characters.
Посмотреть вложение 27601
you already have the base, or you add all the characters you don't want to appear, or do it in another way where only 'abcd and 0-9' is allowedThis is not what I'm looking for unfortunately. I want to block ASCII characters in the list below. I also want to block arabic, russian, chinese, japanese characters.
Посмотреть вложение 27601
you already have the base, or you add all the characters you don't want to appear, or do it in another way where only 'abcd and 0-9' is allowed
#include <amxmodx>
#include <fakemeta>
#define PLUGIN "CS Revo: Clear Name"
#define VERSION "1.0"
#define AUTHOR "Wilian M."
new const whitelist[][] =
{
"!",
".",
"=",
"<",
">",
"`",
";",
"/",
"*",
"+",
"#",
"}",
"{",
"[",
"]",
"-",
"|",
"~",
"$",
"?",
"'",
"%",
"%",
"_",
"@",
"q",
"w",
"e",
"r",
"t",
"y",
"u",
"o",
"p",
"a",
"s",
"d",
"f",
"g",
"h",
"j",
"k",
"l",
"z",
"x",
"c",
"v",
"b",
"n",
"m",
"i",
"I",
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_forward(FM_ClientUserInfoChanged, "xClearName", false)
}
public client_putinserver(id)
{
if(xClearName(id))
return PLUGIN_CONTINUE
return PLUGIN_CONTINUE
}
public xClearName(id)
{
static name[128]
get_user_info(id, "name", name, 121)
remove_quotes(name)
trim(name)
static i, xFind
xFind = -1
for(i = 0; i < sizeof(whitelist); i++)
{
if(containi(name, whitelist[i]) != -1){
xFind = true
}
if(xFind != -1)
break
}
if(xFind != -1)
{
client_print_color(id, print_team_default, "^4Special characters not allowed.")
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}