- Ошибка
-
L 11/24/2020 - 17:33:53: Invalid index 15 (count: 15)
L 11/24/2020 - 17:33:53: [AMXX] Displaying debug trace (plugin "amx_gag.amxx", version "1.4.3")
L 11/24/2020 - 17:33:53: [AMXX] Run time error 10: native error (native "ArrayGetArray")
L 11/24/2020 - 17:33:53: [AMXX] [0] amx_gag.sma::IsUserBlocked (line 352)
L 11/24/2020 - 17:33:53: [AMXX] [1] amx_gag.sma::UserBlock (line 333)
L 11/24/2020 - 17:33:53: [AMXX] [2] amx_gag.sma::GagMenuHandler (line 306)
- ОС
- Linux
- Amx Mod X
-
AMX Mod X 1.9.0.5271
- Билд
-
ReHLDS version: 3.7.0.696-dev
- ReGamedll
-
ReGameDL version: 5.18.0.474-dev
- Версия Metamod
-
Metamod-r v1.3.0.128, API (5:13)
- Список метамодулей
-
1] AMX Mod X RUN- amxmodx_mm_i386.so v1.9.0.5271ini Start ANY
[ 2] Reunion RUN- reunion_mm_i386.so v0.1.0.92c ini Start Never
[ 3] ReSemiclip RUN- resemiclip_mm_i386.so v2.3.9 ini Chlvl ANY
[ 4] WHBlocker RUN- whblocker_mm_i386.sov1.5.697ini Chlvl ANY
[ 5] Ham Sandwich RUN- hamsandwich_amxx_i386.so v1.9.0.5271pl1 ANYANY
[ 6] FakeMetaRUN- fakemeta_amxx_i386.so v1.9.0.5271pl1 ANYANY
[ 7] ReAPIRUN- reapi_amxx_i386.so v5.15.0.197-dev pl1 ANYNever
[ 8] CStrike RUN- cstrike_amxx_i386.sov1.9.0.5271pl1 ANYANY
[ 9] CSX RUN- csx_amxx_i386.so v1.9.0.5271pl1 ANYANY
[10] Engine RUN- engine_amxx_i386.so v1.9.0.5271pl1 ANYANY
[11] Fun RUN- fun_amxx_i386.so v1.9.0.5271pl1 ANYANY
- Список плагинов
-
amx_gag.amxx
- Автор плагина
- neygomon
- Версия плагина
- 1.4.3
- Исходный код
-
#include <amxmodx>
#define SORRY // Разрешить команду /sorry для извинения игроков
#define GAG_ACCESS ADMIN_KICK // Доступ к функциям гага
#define SORRYTIME 30 // Как часто можно пользоваться командой /sorry. Время в секундах
#define PREFIX "*" // Префикс в чате
#define SUPERADMIN // Админ с флагом L(изменить можно на 281 строке) может гагать других админов с иммунитетом
new g_BlockTimes[] = // Время блокировки в минутах
{
5,
10,
30,
60,
180,
300,
600,
1000,
0 // навсегда
}
new g_AllowCommands[][] = // Разрешенные команды
{
"/me",
"/top15",
"/rank",
"/hp",
"/life",
"/stats",
"/top15",
"/top30",
"/vm",
"/vipmenu",
"/rs",
"/dmg",
"/bot",
"/hs",
"/pt",
"/ljtop",
"/ljsmenu",
"/respawn",
"/anew",
"rtv",
"/vips",
"/kills",
"/rankstats",
"/statsme",
"/server",
"timeleft",
"thetime",
"/maps",
"/hats",
"/top",
"/award",
"/vipinfo"
}
/* Словарь плагина */
#define MSG_SORRY_FLOOD "^4%s Прекратите флудить! Повторно^3 извиниться^4 можно через ^3%d сек."
#define MSG_SORRY_ADMIN "^4%s Уважаемый ^3адмнистратор,^4 игрок ^3%s ^4просит снять с него ^3Мут^4."
#define MSG_CHAT_IS_BLOCKED "^4%s Уважаемый ^3%s^4, ваш чат ^3заблокирован^4."
#define MSG_BLOCK_EXPIRED_TIME "^4%s До ^3разблокировки^4 осталось примерно ^3%d мин."
#define MSG_BLOCK_EXPIRED "^4%s ^3Время блокировки ^4истекло^3. Подождите обновления информации."
#define MSG_SAY_SORRY "^4%s Чтобы извиниться, напишите в чат ^3/sorry ^4Возможно, раблокируют раньше."
#define MSG_CHAT_UNBLOCK_ALL "^4%s Игроку ^3%s ^4был^3 разблокирован чат^4 администратором ^3%s."
#define MSG_CHAT_UNBLOCK_PL "^4%s Уважаемый ^3%s^4, администратор ^3%s снял с вас ^3блокировку чата."
#define MSG_CHAT_BLOCK_ALL "^4%s Администратор ^3%s^4 заблокировал чат игроку ^3%s ^4%s."
#define MSG_CHAT_BLOCK_PL "^4%s Уважаемый ^3%s^4, администратор ^3%s ^4заблокировал вам чат ^4%s."
#define STORAGE "addons/amxmodx/data/amx_gag.dat"
#define MAX_ITEMS 1000
#define GetBit(%1,%2) (%1 & (1 << (%2 & 31)))
#define SetBit(%1,%2) %1 |= (1 << (%2 & 31))
#define ResetBit(%1,%2) %1 &= ~(1 << (%2 & 31))
new g_bitBlockChats;
enum _:DATA
{
IP[16],
STEAMID[25],
BLOCKTIME
};
new g_aLoadedData[33][DATA];
new Trie:g_tAllowCmds;
new Array:g_aUsersBlocked;
new g_arrData[DATA];
new pl[32], pnum;
public plugin_init()
{
#define VERSION "1.4.3"
register_plugin("Advanced Gag", VERSION, "neygomon");
register_cvar("adv_gag", VERSION, FCVAR_SERVER | FCVAR_SPONLY);
register_clcmd("amx_gagmenu", "ClCmdGagMenu");
register_menucmd(register_menuid("AmxGag Menu"), 1023, "GagMenuHandler");
register_clcmd("say", "SayChat");
register_clcmd("say_team", "SayChat");
set_task(60.0, "CheckBlockedUsers", .flags = "b");
}
public plugin_cfg()
{
g_aUsersBlocked = ArrayCreate(DATA);
new fp = fopen(STORAGE, "rt");
if(fp)
{
new i, blocktime[15], buffer[128];
new sys = get_systime();
while(!feof(fp) && i < MAX_ITEMS)
{
fgets(fp, buffer, charsmax(buffer));
trim(buffer);
if(buffer[0] == EOS || buffer[0] == ';') continue;
if(parse(buffer,
g_arrData[IP], charsmax(g_arrData[IP]),
g_arrData[STEAMID], charsmax(g_arrData[STEAMID]),
blocktime, charsmax(blocktime)
)
)
{
g_arrData[BLOCKTIME] = str_to_num(blocktime);
if(!g_arrData[BLOCKTIME] || g_arrData[BLOCKTIME] > sys)
{
ArrayPushArray(g_aUsersBlocked, g_arrData);
i++;
}
}
}
fclose(fp);
}
g_tAllowCmds = TrieCreate();
for(new i; i < sizeof g_AllowCommands; i++)
TrieSetCell(g_tAllowCmds, g_AllowCommands[i], i);
}
public client_putinserver(id)
{
if(is_user_bot(id) || is_user_hltv(id)) return;
get_user_ip(id, g_aLoadedData[id][IP], charsmax(g_aLoadedData[][IP]), 1);
get_user_authid(id, g_aLoadedData[id][STEAMID], charsmax(g_aLoadedData[][STEAMID]));
if(IsUserBlocked(id, g_aLoadedData[id][IP], g_aLoadedData[id][STEAMID]) != -1)
SetBit(g_bitBlockChats, id);
else ResetBit(g_bitBlockChats, id);
}
public SayChat(id)
{
if(!GetBit(g_bitBlockChats, id))
return PLUGIN_CONTINUE;
static sMessage[128];
read_args(sMessage, charsmax(sMessage));
remove_quotes(sMessage);
if(TrieKeyExists(g_tAllowCmds, sMessage))
return PLUGIN_CONTINUE;
#if defined SORRY
else if(!strcmp(sMessage, "/sorry"))
{
static iFloodTime[33], systime;
if(iFloodTime[id] > (systime = get_systime()))
client_print_color(id, print_team_default, MSG_SORRY_FLOOD, PREFIX, iFloodTime[id] - systime);
else
{
static sName[32]; get_user_name(id, sName, charsmax(sName));
get_players(pl, pnum, "ch");
for(new i; i < pnum; i++)
{
if(get_user_flags(pl[i]) & GAG_ACCESS)
client_print_color(pl[i], print_team_default, MSG_SORRY_ADMIN, PREFIX, sName);
}
iFloodTime[id] = systime + SORRYTIME;
}
}
#endif
else
{
static sName[32], ost;
get_user_name(id, sName, charsmax(sName));
client_print_color(id, print_team_default, MSG_CHAT_IS_BLOCKED, PREFIX, sName);
if(g_aLoadedData[id][BLOCKTIME])
{
if((ost = g_aLoadedData[id][BLOCKTIME] - get_systime()) / 60 > 0)
client_print_color(id, print_team_default, MSG_BLOCK_EXPIRED_TIME, PREFIX, ost / 60);
else client_print_color(id, print_team_default, MSG_BLOCK_EXPIRED, PREFIX);
client_print_color(id, print_team_default, MSG_BLOCK_EXPIRED, PREFIX);
}
client_print_color(id, print_team_default, MSG_SAY_SORRY, PREFIX);
}
return PLUGIN_HANDLED;
}
public CheckBlockedUsers()
{
static i, sys; sys = get_systime();
get_players(pl, pnum);
for(i = 0; i < pnum; i++)
{
if(g_aLoadedData[pl[i]][BLOCKTIME] && sys > g_aLoadedData[pl[i]][BLOCKTIME])
UserBlock(pl[i], 0);
}
}
new g_iMenuSelectBlock[33], g_iMenuPos[33], players[33][32];
public ClCmdGagMenu(id)
{
if(get_user_flags(id) & GAG_ACCESS)
{
g_iMenuSelectBlock[id] = g_iMenuPos[id] = 0;
ShowGagMenu(id, 0);
}
return PLUGIN_HANDLED;
}
ShowGagMenu(id, iPos)
{
new sMenu[512], iLen, iKeys, sName[32], a, start, end;
get_players(players[id], pnum, "ch");
start = iPos * 7;
end = start + 7;
a = 0;
if(start >= pnum) start = iPos = g_iMenuPos[id] = 0;
if(end > pnum) end = pnum;
iLen = formatex(sMenu, charsmax(sMenu), "\w[\rМутнуть\w] Выберите игрока\w\R%d/%d^n^n", iPos + 1, (pnum / 7 + ((pnum % 7) ? 1 : 0))), iKeys = MENU_KEY_0|MENU_KEY_8;
#if defined SUPERADMIN
new bool:superadmin = bool:(get_user_flags(id) & ADMIN_RCON);
#endif
for(new i = start; i < end; i++)
{
get_user_name(players[id][i], sName, charsmax(sName));
if(id == players[id][i])
iLen += formatex(sMenu[iLen], charsmax(sMenu) - iLen, "\r%d. \d%s \w[\rТы\w]^n", ++a, sName);
#if defined SUPERADMIN
else if(!superadmin && get_user_flags(players[id][i]) & ADMIN_IMMUNITY)
#else
else if(get_user_flags(players[id][i]) & ADMIN_IMMUNITY)
#endif
iLen += formatex(sMenu[iLen], charsmax(sMenu) - iLen, "\r%d. \d%s \w[\rАдмин\w]^n", ++a, sName);
else
{
iKeys |= (1 << a++);
if(GetBit(g_bitBlockChats, players[id][i]))
iLen += formatex(sMenu[iLen], charsmax(sMenu) - iLen, "\r%d. \w%s \w[\rУбрать Мут\w]^n", a, sName);
else
iLen += formatex(sMenu[iLen], charsmax(sMenu) - iLen, "\r%d. \w%s^n", a, sName);
}
}
if(!g_BlockTimes[g_iMenuSelectBlock[id]])
iLen += formatex(sMenu[iLen], charsmax(sMenu) - iLen, "^n\r8. \wМутнуть \rнавсегда^n^n");
else iLen += formatex(sMenu[iLen], charsmax(sMenu) - iLen, "^n\r8. \wМутнуть на \r%d \wмин^n^n", g_BlockTimes[g_iMenuSelectBlock[id]]);
if(end != pnum)
{
formatex(sMenu[iLen], charsmax(sMenu) - iLen, "\r9. \wДалее^n\r0. \r%s", iPos ? "Назад" : "Выход");
iKeys |= MENU_KEY_9;
}
else formatex(sMenu[iLen], charsmax(sMenu) - iLen, "\r0. \r%s", iPos ? "Назад" : "Выход");
return show_menu(id, iKeys, sMenu, -1, "AmxGag Menu");
}
public GagMenuHandler(id, iKey)
{
switch(iKey)
{
case 7:
{
if(++g_iMenuSelectBlock[id] > charsmax(g_BlockTimes))
g_iMenuSelectBlock[id] = 0;
ShowGagMenu(id, g_iMenuPos[id]);
}
case 8: ShowGagMenu(id, ++g_iMenuPos[id]);
case 9: if(g_iMenuPos[id]) ShowGagMenu(id, --g_iMenuPos[id]);
default:
{
new sNameAdmin[32], sNamePlayer[32];
new iPlayer = players[id][g_iMenuPos[id] * 7 + iKey];
get_user_name(id, sNameAdmin, charsmax(sNameAdmin));
get_user_name(iPlayer, sNamePlayer, charsmax(sNamePlayer));
if(GetBit(g_bitBlockChats, iPlayer))
{
UserBlock(iPlayer, 0);
client_print_color(iPlayer, print_team_default, MSG_CHAT_UNBLOCK_PL, PREFIX, sNamePlayer, sNameAdmin);
client_print_color(0, print_team_default, MSG_CHAT_UNBLOCK_ALL, PREFIX, sNamePlayer, sNameAdmin);
}
else
{
UserBlock(iPlayer, 1, g_BlockTimes[g_iMenuSelectBlock[id]]);
new blocktimeinfo[32];
if(!g_BlockTimes[g_iMenuSelectBlock[id]])
formatex(blocktimeinfo, charsmax(blocktimeinfo), "навсегда");
else formatex(blocktimeinfo, charsmax(blocktimeinfo), "на %d минут", g_BlockTimes[g_iMenuSelectBlock[id]]);
client_print_color(iPlayer, print_team_default, MSG_CHAT_BLOCK_PL, PREFIX, sNamePlayer, sNameAdmin, blocktimeinfo);
client_print_color(0, print_team_default, MSG_CHAT_BLOCK_ALL, PREFIX, sNameAdmin, sNamePlayer, blocktimeinfo);
}
ShowGagMenu(id, g_iMenuPos[id]);
}
}
return PLUGIN_HANDLED;
}
UserBlock(id, block, btime = 0)
{
switch(block)
{
case 0: IsUserBlocked(id, g_aLoadedData[id][IP], g_aLoadedData[id][STEAMID], 1);
case 1:
{
g_aLoadedData[id][BLOCKTIME] = !btime ? 0 : get_systime() + btime * 60;
ArrayPushArray(g_aUsersBlocked, g_aLoadedData[id]);
SetBit(g_bitBlockChats, id);
client_cmd(id, "-voicerecord");
}
}
}
IsUserBlocked(id, const Ip[], const SteamID[], UnBlock = 0)
{
static i, ArraySizee, sys; sys = get_systime();
ArraySizee = ArraySize(g_aUsersBlocked);
for(i = 0; i < ArraySizee; i++)
{
ArrayGetArray(g_aUsersBlocked, i, g_arrData);
if(!strcmp(g_arrData[IP], Ip) || !strcmp(g_arrData[STEAMID], SteamID))
{
if(!UnBlock && (!g_arrData[BLOCKTIME] || g_arrData[BLOCKTIME] > sys))
{
g_aLoadedData[id][BLOCKTIME] = g_arrData[BLOCKTIME];
return i;
}
else
{
ArrayDeleteItem(g_aUsersBlocked, i);
ResetBit(g_bitBlockChats, id);
}
break;
}
}
return -1;
}
public plugin_end()
{
if(file_exists(STORAGE))
unlink(STORAGE);
new ArraySizee, fp = fopen(STORAGE, "w+");
if(!fprintf(fp, "; File generated by AMX Gag. [ neygomon | https://neugomon.ru ]^n^n"))
{
new err[128]; formatex(err, charsmax(err), "Plugin not write file %s! Users not saved!", STORAGE);
set_fail_state(err);
}
ArraySizee = ArraySize(g_aUsersBlocked);
for(new i; i < ArraySizee; i++)
{
ArrayGetArray(g_aUsersBlocked, i, g_arrData);
fprintf(fp, "^"%s^" ^"%s^" ^"%d^"^n", g_arrData[IP], g_arrData[STEAMID], g_arrData[BLOCKTIME]);
}
if(ArraySizee) log_amx("Successfully saved %d items in %s :)", ArraySizee, STORAGE);
fclose(fp);
ArrayDestroy(g_aUsersBlocked);
TrieDestroy(g_tAllowCmds);
}
Помогите пожалуйста