Участник
Пользователь
- Сообщения
- 93
- Реакции
- 12
- Ошибка
-
// I:\scripting\AdminNickGuard.sma(79) : warning 233: symbol "strbreak" is marked as deprecated: Use argbreak() instead
//
// I:\scripting\AdminNickGuard.sma(117) : error 017: undefined symbol "ColorChat"
// I:\scripting\AdminNickGuard.sma(117) : warning 215: expression has no effect
// I:\scripting\AdminNickGuard.sma(117) : error 001: expected token: ";", but found ")"
// I:\scripting\AdminNickGuard.sma(117) : error 029: invalid expression, assumed zero
// I:\scripting\AdminNickGuard.sma(117) : fatal error 107: too many error messages on one line
//
// Compilation aborted.
// 4 Errors.
// Could not locate output file I:\scripting\compiled\AdminNickGuard.amx (compile failed).
- Компилятор
- Локальный
- Amx Mod X
- 1.9.0
- Исходный код
-
/*
My Plugins: http://skape69ta.clan.su/load/11
My Profile: http://amxmodx.su/forum/memberlist.php?mode=viewprofile&u=455
My Skype: SKAJIbnEJIb619
*/
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <cstrike>
//#include <ColorChat>
new DIRINI[64], trash
new Array:g_array
new pcvar_Nick
public plugin_init() {
register_plugin("Admin Nick Guard", "1.0", "SKAJIbnEJIb")
register_forward(FM_ClientUserInfoChanged, "fwClientUserInfoChanged")
register_concmd("ang_add", "AddNick", ADMIN_RCON, "- <SteamID or IP or ^"S^"(your STEAM) or ^"IP^"(your IP)> <Nick>")
pcvar_Nick = register_cvar("ang_nick", "Player")
new configsDir[64]
get_configsdir(configsDir, 63)
format(DIRINI, 63, "%s/AdminNickGuard.ini", configsDir)
g_array = ArrayCreate(64, 1)
update_nicks()
}
public client_connect(id)
{
new Name[32]
get_user_name(id, Name, 31)
if(CheckNick(id, Name))
{
new Nick_def[32]
get_pcvar_string(pcvar_Nick, Nick_def, 31)
client_cmd(id, "setinfo name ^"^";name %s", Nick_def)
}
}
public fwClientUserInfoChanged(id, buffer) {
if (!is_user_connected(id))
return FMRES_IGNORED
static Name[32], val[32]
get_user_name(id, Name, sizeof Name - 1)
engfunc(EngFunc_InfoKeyValue, buffer, "name", val, sizeof val - 1)
if (equal(val, Name))
return FMRES_IGNORED
if(CheckNick(id, val))
{
new Nick_def[32]
get_pcvar_string(pcvar_Nick, Nick_def, 31)
engfunc(EngFunc_SetClientKeyValue, id, buffer, "name", Nick_def)
client_print(id, print_console, "Запрещено использовать этот ник!")
client_cmd(id, "setinfo name ^"^";name %s", Nick_def)
return FMRES_SUPERCEDE
}
return FMRES_IGNORED
}
public CheckNick(id, Name[])
{
new STEAM[32], IP[32]
get_user_authid(id, STEAM, 31)
get_user_ip(id, IP, 31, 1)
for(new i=0; i < ArraySize(g_array); i++)
{
new str_ini[64], auth_ini[32], nick_ini[32]
ArrayGetString(g_array, i, str_ini, 63)
strbreak(str_ini, auth_ini, 31, nick_ini, 31)
if ( equali(Name, nick_ini) && !(equali(auth_ini, STEAM) || equali(auth_ini, IP)) )
{
log_to_file("AdminNickGuard.log","Nick <%s> | IP <%s> | ID <%s>", Name, IP, STEAM)
return 1
}
}
return 0
}
public AddNick(id, level, cid) {
if(!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED
new arg_auth[32], arg_nick[32], Auth[32]
read_argv(1, arg_auth, 31)
read_argv(2, arg_nick, 31)
trim(arg_auth)
trim(arg_nick)
if(equal(arg_auth ,"STEAM_", 6))
format(Auth, 31, "%s", arg_auth)
else if(equali(arg_auth, "S"))
get_user_authid(id, Auth, 31)
else if(equali(arg_auth, "IP"))
get_user_ip(id, Auth, 31, 1)
else
format(Auth, 31, "%s", arg_auth)
new in_ini[64]
format(in_ini, 63, "%s %s", Auth, arg_nick)
for(new i=0; i <= file_size(DIRINI, 1); i++)
{
new find_ini[64]
read_file(DIRINI, i, find_ini, 63, trash)
if (equali(find_ini, in_ini))
{
ColorChat(id, RED, "^01[^04AdminNickGuard^01]^03 Такая привязка уже есть!")
client_print(id, print_console, "[AdminNickGuard] Такая привязка уже есть!")
return PLUGIN_HANDLED
}
}
write_file(DIRINI, in_ini, -1)
ColorChat(id, BLUE, "^01[^04AdminNickGuard^01]^01 В список добавлена привязка:^03 %s", in_ini)
client_print(id, print_console, "[AdminNickGuard] В список добавлена привязка: %s", in_ini)
update_nicks()
return PLUGIN_HANDLED
}
public update_nicks()
{
if(!file_exists(DIRINI))
write_file(DIRINI, ";STEAM_0:0:12345678 Nick", 0)
ArrayClear(g_array)
for(new i=0; i <= file_size(DIRINI, 1)-2; i++)
{
new Nick_ini[64]
read_file(DIRINI, i, Nick_ini, 63, trash)
if(Nick_ini[0] != ';')
ArrayPushString(g_array, Nick_ini)
}
}
Поможете ? )
В этой теме было размещено решение! Перейти к решению.