Правила форума Гаранты форума
Размещение рекламы AMX-X компилятор

Здравствуйте, гость Вход | Регистрация

Наши новости:

14-дек
24-апр
10-апр
11-апр

> Правила форума

Этот раздел, как вы могли заметить по названию, предназначен для решения вопросов по поводу уже существующих модов и плагинов.
Пожалуйста, если у вас проблема с написанием плагина, не путайте этот раздел с разделом по скриптингу.
Для поиска плагинов и модов существует соответствующий раздел.

Название темы должно соответствовать содержанию. Темы с названием типа "Помогите", "Вопрос", "парни подскажите..." - будут удалены.
Все темы, не относящиеся к "Вопросам по модам и плагинам", будут удалены или перемещены в соответствующий раздел.

Правила оформления темы:
1. Помимо заголовка не забудьте верно сформулировать свой вопрос.
2. Выложите исходник (в тег кода + ) или ссылку на плагин который вызывает у вас вопросы.
3. Выложите лог с ошибками (если имеется) под спойлер

Помогите решить ошибку в плагине

Статус пользователя velesgs
сообщение 11.5.2016, 22:08
Сообщение #1


Стаж: 10 лет
Город: Хмельницкий

Сообщений: 198
Благодарностей: 48
Полезность: < 0

Ошибка
Код
L 05/11/2016 - 22:25:51: Start of error session.
L 05/11/2016 - 22:25:51: Info (map "de_dust2_2x2") (file "addons/amxmodx/logs/error_20160511.log")
L 05/11/2016 - 22:25:51: [AMXX] Displaying debug trace (plugin "new_antimat.amxx")
L 05/11/2016 - 22:25:51: [AMXX] Run time error 4: index out of bounds
L 05/11/2016 - 22:25:51: [AMXX]    [0] new_antimat.sma::loadfile (line 76)

Словарь содержит 450 слов
как решить данную проблему?
Прикрепленный файл  new_antimat.sma ( 7,12 килобайт ) Кол-во скачиваний: 6


Отредактировал: iShot, - 12.5.2016, 4:57
Причина: Выдано устное предупреждение!
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
Статус пользователя Dukkhaz0r
сообщение 11.5.2016, 22:18
Сообщение #2


Стаж: 12 лет

Сообщений: 343
Благодарностей: 294
Полезность: 812

Код:
#include <amxmodx>
#include <amxmisc>

#define NAME "AntiMat"
#define VERSION "1.0"
#define AUTHOR "Crash94"

stock const ReplaceText[256][128]

new Msg[512], szText[ 555 char ]
new warning_chat[33]
new g_Warning, g_Punishment, g_Bantime

public plugin_init()
{
register_plugin(NAME, VERSION, AUTHOR)

register_clcmd("say", "CheckSay")
register_clcmd("say_team", "CheckSayTeam")

g_Warning = register_cvar("amx_antimat_warning", "3")
g_Punishment = register_cvar("amx_antimat_punishment", "0")
g_Bantime = register_cvar("amx_antimat_bantime", "1")

register_dictionary( "antimat.txt" );
set_task(1.0, "loadfile")
}

public client_disconnect(id)
{
warning_chat[id] = 0
}

stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)

replace_all(msg, 190, "!g", "^4")
replace_all(msg, 190, "!y", "^1")
replace_all(msg, 190, "!team", "^3")

if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}

public loadfile()
{
new config[64]
get_configsdir(config, 64)
format(config, 63, "%s/antimat.ini", config)

new line = 0
new textsize = 0
new text[128]
new temp[128]
new i = 0

if (file_exists(config))
{
while(read_file(config,line,text,255,textsize))
{
format(temp,127,"%s",text)
ReplaceText[i++]=temp
line++
}
}
}

public CheckSay(id)
{
if(is_user_hltv(id) || is_user_bot(id) || !is_user_connected(id))
{
return PLUGIN_CONTINUE;
}

new message[192],Len
new szName[32], i
new iPlayer[32], iNum

read_args(message, 191);
remove_quotes(message);

get_players(iPlayer, iNum)
get_user_name(id,szName,31);

for(i = 0 ; i < sizeof (ReplaceText) ; i++)
{
if(containi(message, ReplaceText[i]) != -1)
{
++warning_chat[id]

if(is_user_alive(id))
{
Len = format(Msg[Len], charsmax(Msg) - 1, "");
Len += format(Msg[Len], charsmax(Msg) - 1, "!team%s !y: ",szName);
Len += format(Msg[Len], charsmax(Msg) - 1, "%s",message);

formatex( szText, charsmax( szText ), "!g%L!y", id, "ANTIMAT_REPLACE_TEXT");
replace_all(Msg, charsmax(Msg), ReplaceText[i], szText)

for(new i; i < iNum; i++)
{
if (is_user_connected(iPlayer[i]) && is_user_alive(iPlayer[i]))
{
ChatColor(iPlayer[i], Msg)
}
}
check_warning(id)
}else{
Len = format(Msg[Len], charsmax(Msg) - 1, "!y *DEAD* ");
Len += format(Msg[Len], charsmax(Msg) - 1, "!team%s !y: ",szName);
Len += format(Msg[Len], charsmax(Msg) - 1, "%s",message);

formatex( szText, charsmax( szText ), "!g%L!y", id, "ANTIMAT_REPLACE_TEXT");
replace_all(Msg, charsmax(Msg), ReplaceText[i], szText)

for(new i; i < iNum; i++)
{
if (is_user_connected(iPlayer[i]) && !is_user_alive(iPlayer[i]))
{
ChatColor(iPlayer[i], Msg)
}
}
check_warning(id)
}
return PLUGIN_HANDLED_MAIN
}
}
return PLUGIN_CONTINUE;
}

public CheckSayTeam(id)
{
if(is_user_hltv(id) || is_user_bot(id) || !is_user_connected(id))
{
return PLUGIN_CONTINUE;
}

new message[192],Len
new szName[32], i, j
new iPlayer[32], iNum

read_args(message, 191);
remove_quotes(message);

get_players(iPlayer, iNum)
get_user_name(id,szName,31);

for(i = 0 ; i < sizeof (ReplaceText) ; i++)
{
if(containi(message, ReplaceText[i]) != -1)
{
++warning_chat[id]

if(is_user_alive(id))
{
if(get_user_team(id)==1)
{
Len = format(Msg[Len], charsmax(Msg) - 1, "!y(Terrorist)");
}else{
Len = format(Msg[Len], charsmax(Msg) - 1, "!y(Counter-Terrorist)");
}

Len += format(Msg[Len], charsmax(Msg) - 1, "!team%s !y: ",szName);
Len += format(Msg[Len], charsmax(Msg) - 1, "%s",message);

formatex( szText, charsmax( szText ), "!g%L!y", id, "ANTIMAT_REPLACE_TEXT");
replace_all(Msg, charsmax(Msg), ReplaceText[i][j], szText)

for(new i; i < iNum; i++)
{
if (is_user_connected(iPlayer[i]) && is_user_alive(iPlayer[i]))
{
ChatColor(iPlayer[i], Msg)
}
}
check_warning(id)
}else{
if(get_user_team(id)==1)
{
Len = format(Msg[Len], charsmax(Msg) - 1, "!y*DEAD*(Terrorist)");
}else{
Len = format(Msg[Len], charsmax(Msg) - 1, "!y*DEAD*(Counter-Terrorist)");
}

Len += format(Msg[Len], charsmax(Msg) - 1, "!team%s !y: ",szName);
Len += format(Msg[Len], charsmax(Msg) - 1, "%s",message);

formatex( szText, charsmax( szText ), "!g%L!y", id, "ANTIMAT_REPLACE_TEXT");
replace_all(Msg, charsmax(Msg), ReplaceText[i][j], szText)

for(new i; i < iNum; i++)
{
if (is_user_connected(iPlayer[i]) && !is_user_alive(iPlayer[i]))
{
ChatColor(iPlayer[i], Msg)
}
}
check_warning(id)
}
return PLUGIN_HANDLED_MAIN
}
}
return PLUGIN_CONTINUE;
}

public check_warning(id)
{
if(warning_chat[id]>=get_pcvar_num(g_Warning))
{
switch(get_pcvar_num(g_Punishment))
{
case 0:
{
new name[32]
get_user_name(id, name, 31)
server_cmd("kick #%d ^"%L^"", get_user_userid(id), id, "ANTIMAT_REASON_KICK")
ChatColor(0, "%L",0,"ANTIMAT_KICKPLAYER", name)
}

case 1:
{
new ip[32], name[32]
get_user_ip(id, ip, 31, 1)
get_user_name(id, name, 31)
server_cmd("addip %d %s; writeip", get_pcvar_num(g_Bantime), ip)
ChatColor(0, "%L",0,"ANTIMAT_BANPLAYER", name, get_pcvar_num(g_Bantime))
}
default:
{
new name[32]
get_user_name(id, name, 31)
server_cmd("kick #%d ^"%L^"", get_user_userid(id), id, "ANTIMAT_REASON_KICK")
ChatColor(0, "%L",0,"ANTIMAT_KICKPLAYER", name)
}
}
}else{
ChatColor(id, "%L",0,"ANTIMAT_WARNING_INFO")
ChatColor(id, "%L",0,"ANTIMAT_WARNING_INFO1", warning_chat[id], get_pcvar_num(g_Warning))
}
}


Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
  Ответить в данную темуНачать новую тему
 
0 пользователей и 1 гостей читают эту тему: