Проблемы с Ucc

Сообщения
95
Реакции
6
Помог
2 раз(а)
Ошибка
не работает amx_gagmenu
ОС
Windows
Amx Mod X
AMX Mod X 1.9.0.5235 (http://www.amxmodx.org)
Authors:
David "BAILOPAN" Anderson, Pavol "PM OnoTo" Marko
Felix "SniperBeamer" Geyer, Jonny "Got His Gun" Bergstrom
Lukasz "SidLuke" Wlasinski, Christian "Basic-Master" Hammacher
Borja "faluco" Ferrer, Scott "DS" Ehlert
Compiled: Dec 18 2018 01:20:16
Built from: https://github.com/alliedmodders/amxmodx/commit/6c53524d
Build ID: 5235:6c53524d
Core mode: JIT+ASM32
Билд
Protocol version 48
Exe version 1.1.2.7 (cstrike)
ReHLDS version: 3.4.0.668-dev
Build date: 09:47:42 Sep 29 2018 (1631)
Build from: https://github.com/dreamstalker/rehlds/commit/89be216
ReGamedll
ReGameDLL version: 5.7.0.319-dev
Build date: 10:52:38 Dec 23 2018
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/9d89a34
Версия Metamod
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 15:47:38 Aug 24 2018
Metamod-r from: https://github.com/theAsmodai/metamod-r/commit/0cf2f70
Список метамодулей
Currently loaded plugins:
description stat pend file vers src load unload
[ 1] AMX Mod X RUN - amxmodx.so v1.9.0.5241 ini ANY
[ 2] Reunion RUN - reunion.so v0.1.0.92 ini Start Never
[ 3] Revoice RUN - revoice.so v0.1.0.32 ini Start Never
[ 4] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[ 5] Rechecker RUN - rechecker_mm_i386.so v2.5 ini ANY
[ 6] WHBlocker RUN - whblocker_mm_i386.so v1.5.696 ini ANY
[ 7] ReSRDetector RUN - resrdetector_mm_i386.so v0.1.0 ini ANY
[ 8] ReSemiclip RUN - resemiclip_mm_i386.so v2.3.9 ini ANY
[ 9] VoiceTranscoder RUN - VoiceTranscoder.so v2017RC3 ini ANY
[10] MySQL RUN - mysql_amxx_i386.so v1.9.0.5241 pl1 ANY
[11] ReAPI RUN - reapi_amxx_i386.so v5.8.0.165-dev pl1 ANY Never
[12] ReAimDetector RUN - reaimdetector_amxx_i386.so v0.2.2 pl1 ANY Never
[13] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5241 pl1 ANY
[14] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5241 pl1 ANY
[15] CStrike RUN - cstrike_amxx_i386.so v1.9.0.5241 pl1 ANY
[16] Engine RUN - engine_amxx_i386.so v1.9.0.5241 pl1 ANY
[17] Fun RUN - fun_amxx_i386.so v1.9.0.5241 pl1 ANY
17 plugins, 17 running
Список плагинов
Currently loaded plugins:
name version author file status
[ 1] Admin Base 1.9.0.5235 AMXX Dev Team admin.amxx running
[ 2] Admin Commands 1.9.0.5235 AMXX Dev Team admincmd.amxx running
[ 3] Admin Help 1.9.0.5235 AMXX Dev Team adminhelp.amxx running
[ 4] Slots Reservation 1.9.0.5235 AMXX Dev Team adminslots.amxx running
[ 5] Multi-Lingual System 1.9.0.5235 AMXX Dev Team multilingual.am running
[ 6] Menus Front-End 1.9.0.5235 AMXX Dev Team menufront.amxx running
[ 7] Commands Menu 1.9.0.5235 AMXX Dev Team cmdmenu.amxx running
[ 8] Players Menu 1.9.0.5235 AMXX Dev Team plmenu.amxx running
[ 9] Maps Menu 1.9.0.5235 AMXX Dev Team mapsmenu.amxx running
[ 10] Plugin Menu 1.9.0.5235 AMXX Dev Team pluginmenu.amxx running
[ 11] Admin Chat 1.9.0.5235 AMXX Dev Team adminchat.amxx running
[ 12] Anti Flood 1.9.0.5235 AMXX Dev Team antiflood.amxx running
[ 13] Scrolling Message 1.9.0.5235 AMXX Dev Team scrollmsg.amxx running
[ 14] Info. Messages 1.9.0.5235 AMXX Dev Team imessage.amxx running
[ 15] Admin Votes 1.9.0.5235 AMXX Dev Team adminvote.amxx running
[ 16] NextMap 1.9.0.5235 AMXX Dev Team nextmap.amxx running
[ 17] Nextmap Chooser 1.9.0.5235 AMXX Dev Team mapchooser.amxx running
[ 18] TimeLeft 1.9.0.5235 AMXX Dev Team timeleft.amxx running
[ 19] Pause Plugins 1.9.0.5235 AMXX Dev Team pausecfg.amxx running
[ 20] Stats Configuration 1.9.0.5235 AMXX Dev Team statscfg.amxx running
[ 21] StatsX 1.9.0.5235 AMXX Dev Team statsx.amxx running
[ 22] Public Core 0.1 Skiptik CorePublic.amxx debug
[ 23] Money 1.0 Skiptik TransferMoney.a debug
[ 24] unknown unknown unknown CustomAk47.amxx debug
[ 25] unknown unknown unknown CustomM4a1.amxx debug
[ 26] unknown unknown unknown CustomAwp.amxx debug
[ 27] unknown unknown unknown CustomDeagle.am debug
[ 28] unknown unknown unknown CustomKnifeSpee debug
[ 29] unknown unknown unknown CustomKnifeGrav debug
[ 30] unknown unknown unknown CustomKnifeUltr debug
[ 31] unknown unknown unknown CustomKnifeGold debug
[ 32] Ultimate Chats Control 4.7 neygomon ucc.amxx running
[ 33] unknown unknown unknown ucc_api_example running
[ 34] UCC Addon: VoteGAG 1.2 neygomon ucc_votegag.amx running
[ 35] Advanced Experience Sy 0.5.9 [REA serfreeman1337/s aes_main.amxx running
[ 36] AES: CStrike Addon 0.5.9 [REA serfreeman1337/s aes_exp_cstrike running
[ 37] AES: Informer 0.5.9 [REA serfreeman1337/s aes_informer.am running
[ 38] AES: Admin Tools 0.5.9 [REA serfreeman1337/s aes_exp_editor. running
[ 39] AES: Bonus System 0.5.9 Vega serfreeman1337/s aes_bonus_syste running
[ 40] AES: Bonus CSTRIKE 0.5.9 [REA serfreeman1337/s aes_bonus_cstri running
40 plugins, 40 running
Автор плагина
@Neugomon
Версия плагина
4.7
Исходный код
#include <amxmodx>
#include <sqlx>
#tryinclude <reapi>
const REASON_LENGTH = 64;

#define DB_HOST "" // MySQL Host
#define DB_USER "" // MySQL User
#define DB_PASS "" // MySQL Password
#define DB_NAME "" // MySQL Name

#define CLEAR_PERIOD 30 // Через сколько дней удалять истекшие GAG'и из MySQL

#define SORRY // Разрешить команду /sorry для извинения игроков
#define MUTEMENU // Поддержка команды /mute
#define GAG_ACCESS ADMIN_BAN // Доступ к функциям гага
#define SORRYTIME 60 // Как часто можно пользоваться командой /sorry. Время в секундах
#define PREFIX "UCC" // Префикс в чате
#define SUPERADMIN ADMIN_RCON
// * Админ с флагом L может гагать других админов с иммунитетом
// * Админ с флагом L может снимать все гаги
// * Админ без этого флага не сможет снимать чужие гаги
// *** Если не требуется - закомментируйте ***

#define CHATS_BY_STATS // Включает функции блокировки чата игрокам, которые не набрали N фрагов/опыта на сервере
#define VOICE_CONTROL_BY_STATS 0
// 0 - CSX
// 1 - CSSTATS MYSQL by SKAJIbnEJIb
// 2 - CSSTATSX SQL by serfreeman1337
// 3 - AES 0.5 Vega by serfreeman1337
#define BLOCK_TEXT_CHAT_BY_STATS
// Блокировать текстовый чат и голосовой
// Если закомментировано - блокировуется только голос
#define BLOCK_CHATS_INFO
// Выводит в текстовый чат сообщение о том, что чат/чаты для игрока заблокированы
#define DEFAULT_BLOCK_TYPE TEXT_CHAT
// Как по умолчанию GAG'ать
// TEXT_CHAT
// VOICE_CHAT
// ALL_CHATS
const MIN_FRAGS = 10;
// Минимальное количество фрагов для доступа к микро
// Для VOICE_CONTROL_BY_STATS 3 настройка принимает значение ранга юзера(начиная с 1)
const ADMIN_FLAG = ADMIN_IMMUNITY;
// Флаг доступа, для которого не будут работать функции CHATS_BY_STATS

new g_BlockTimes[] = // Время блокировки GAG в минутах
{
5,
10,
30,
60,
180,
0 // навсегда
}

new g_BlockTypes[3][] = // Названия пунктов для блокировки
{
"Text Chat",
"Voice Chat",
"All Chats"
}

new g_Reasons[][REASON_LENGTH] = // Причины GAG'ов
{
"Пездюк",
"Много говоришь",
"Неадекват",
"Мамоеб"
}

new g_AllowCommands[][] = // Разрешенные команды
{
"/me",
"/top15",
"/rank",
"/hp"
}

/* Словарь плагина */
#define MSG_SORRY_FLOOD "^1[^4%s^1] ^3Прекратите флудить! ^4Повторно извиниться можно через ^3%d сек"
#define MSG_SORRY_ADMIN "^1[^4%s^1] ^4Уважаемый ^3адмнистратор^4, ^3%s ^4просит снять ^3GAG^4! Причина GAG'a ^3%s"
#define MSG_CHAT_IS_BLOCKED "^1[^4%s^1] ^4Уважаемый ^3%s^4, Ваш чат ^3заблокирован^4! Причина ^3%s"
#define MSG_BLOCK_EXPIRED_TIME "^1[^4%s^1] ^4До разблокировки осталось ^1примерно ^3%d ^4мин."
#define MSG_BLOCK_EXPIRED "^1[^4%s^1] ^4Время блокировки ^3истекло^4. ^1Подождите обновления информации ..."
#define MSG_SAY_SORRY "^1[^4%s^1] ^4Чтобы извиниться, напишите в чат ^3/sorry^4. Возможно, разблокируют раньше :)"
#define MSG_CHAT_UNBLOCK_ALL "^1[^4%s^1] ^4Игроку ^3%s ^4был разблокирован чат администратором ^3%s"
#define MSG_CHAT_UNBLOCK_PL "^1[^4%s^1] ^4Уважаемый ^3%s^4, администратор ^3%s ^4снял с Вас блокировку чата"

#define MSG_TEXTCHAT_BLOCK_ALL "^1[^4%s^1] ^4Администратор ^3%s ^4заблокировал ^1text ^4игроку ^3%s ^1%s^4. Причина ^3%s"
#define MSG_TEXTCHAT_BLOCK_PL "^1[^4%s^1] ^4Уважаемый ^3%s^4, администратор ^3%s ^4заблокировал Вам ^1text ^1%s^4. Причина ^3%s"
#define MSG_VOICECHAT_BLOCK_ALL "^1[^4%s^1] ^4Администратор ^3%s ^4заблокировал ^1voice игроку ^3%s ^1%s^4. Причина ^3%s"
#define MSG_VOICECHAT_BLOCK_PL "^1[^4%s^1] ^4Уважаемый ^3%s^4, администратор ^3%s ^4заблокировал Вам ^1voice ^1%s^4. Причина ^3%s"
#define MSG_ALLCHATS_BLOCK_ALL "^1[^4%s^1] ^4Администратор ^3%s ^4заблокировал ^1text+voice ^4игроку ^3%s ^1%s^4. Причина ^3%s"
#define MSG_ALLCHATS_BLOCK_PL "^1[^4%s^1] ^4Уважаемый ^3%s^4, администратор ^3%s ^4заблокировал Вам ^1text+voice ^1%s^4. Причина ^3%s"

#define MSG_MUTE_ALL_PLAYERS "^1[^4%s^1] ^4Вы установили mute на ^3всех ^4игроков."
#define MSG_UNMUTE_ALL_PLAYERS "^1[^4%s^1] ^4Вы сняли mute со ^3всех ^4игроков."
#define MSG_UNMUTE_PLAYER "^1[^4%s^1] ^4Вы сняли ^3mute ^4с игрока ^3%s^4."
#define MSG_MUTE_PLAYER "^1[^4%s^1] ^4Вы установили ^3mute ^4на игрока ^3%s^4."
#define MSG_BLOCK_CHATS0 "^1[^4%s^1] ^4Доступ к текстовому и голосовому чатам ^3закрыт^4!"
#define MSG_BLOCK_CHATS1 "^1[^4%s^1] ^4Доступ к голосовому чату ^3закрыт^4!"
#define MSG_BLOCK_CHATS2 "^1[^4%s^1] ^4Необходимо получить уровень ^3%s!"
#define MSG_BLOCK_CHATS3 "^1[^4%s^1] ^4Необходимо набрать ^3%i^1/^3%i ^4фрагов"

/* Технические данные */

#if defined CHATS_BY_STATS && !defined _reapi_included
#include <hamsandwich>
#endif
enum MENU_SETTINGS
{
Menu,
SelectTime,
SelectReason,
SelectType,
Pos
};
enum MENUS
{
GAG,
MUTE
};
enum BLOCK_TYPES
{
NONE = -1,
STATS,
TEXT_CHAT,
VOICE_CHAT,
ALL_CHATS
}
enum queStates
{
SQL_INIT,
DROP_TABLE,
LOAD_PLAYER,
SAVE_BLOCK,
REMOVE_BLOCK
};
enum _:BlockInfo
{
expired,
reason[REASON_LENGTH],
admin_steamid[32],
BLOCK_TYPES:GagBlockType
};

#if !defined MAX_PLAYERS
const MAX_PLAYERS = 32;
#endif
new Handle:g_hTuple, g_szQuery[1024], g_Data[3];
new g_BlockInfo[MAX_PLAYERS + 1][BlockInfo];
new Trie:g_tAllowCmds;
new pl[MAX_PLAYERS], pnum;
new g_iMutePlayer[MAX_PLAYERS + 1][MAX_PLAYERS + 1];
new g_arrPlayers[MAX_PLAYERS + 1][MAX_PLAYERS];
new g_iMenuInfo[MAX_PLAYERS + 1][MENU_SETTINGS];
#if AMXX_VERSION_NUM < 183
#include <colorchat>
#endif
#if !defined _reapi_included
#include <VtcApi>
#endif
#if defined MUTEMENU && !defined _reapi_included
#include <fakemeta>
#endif
#if defined CHATS_BY_STATS
#if VOICE_CONTROL_BY_STATS == 0
#include <csstats>
#endif
#if VOICE_CONTROL_BY_STATS == 1
#include <csstats_mysql>
#endif
#if VOICE_CONTROL_BY_STATS == 2
#include <csstatsx_sql>
#endif
#if VOICE_CONTROL_BY_STATS == 3
#include <aes_v>
#endif
#if defined BLOCK_CHATS_INFO
new g_iFragStats[MAX_PLAYERS + 1];
#if VOICE_CONTROL_BY_STATS == 3
new g_szAesLevelName[64];
#endif
#endif
#endif
#if !defined REAPI_VERSION || REAPI_VERSION < 52145
#error Needed ReAPI version >= 5.2.0.145
#endif

#define is_blocked_text_chat(%0) (g_BlockInfo[%0][GagBlockType] == TEXT_CHAT || g_BlockInfo[%0][GagBlockType] == ALL_CHATS)
#define is_blocked_voice_chat(%0) (g_BlockInfo[%0][GagBlockType] == VOICE_CHAT || g_BlockInfo[%0][GagBlockType] == ALL_CHATS)

public plugin_natives()
{
register_native("ucc_is_client_gaged", "native_ucc_is_client_gaged");
register_native("ucc_set_client_gag", "native_ucc_set_client_gag");
#if defined MUTEMENU
register_native("ucc_is_client_muted", "native_ucc_is_client_muted");
register_native("ucc_set_client_muted", "native_ucc_set_client_muted");
#endif
}

public plugin_init()
{
#define PNAME "Ultimate Chats Control"
#define VERSION "4.7"
#define AUTHOR "neygomon"
register_plugin(PNAME, VERSION, AUTHOR);
register_cvar("ucc_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY);
#if defined _reapi_included
if(has_vtc())
{
register_clcmd("amx_gagmenu", "ClCmdGagMenu");
#if defined CHATS_BY_STATS
RegisterHookChain(RG_CBasePlayer_Spawn, "CBasePlayer_Spawn_Post", true);
#endif
}
#if !defined MUTEMENU
else set_fail_state("Needed meta plugin VTC [https://my-amxx.ru/threads/257/]");
#endif
#if defined MUTEMENU
RegisterHookChain(RG_CSGameRules_CanPlayerHearPlayer, "CanPlayerHearPlayer_Pre", false);
#endif
#else
register_clcmd("amx_gagmenu", "ClCmdGagMenu");
#if defined CHATS_BY_STATS
RegisterHam(Ham_Spawn, "player", "CBasePlayer_Spawn_Post", true);
#endif
#endif
#if defined MUTEMENU
register_clcmd("say /mute", "ClCmdMuteMenu");
register_clcmd("say_team /mute", "ClCmdMuteMenu");
#if !defined _reapi_included
register_forward(FM_Voice_SetClientListening, "SetClientListening_Pre", false);
#endif
#endif
#if defined SORRY
register_clcmd("say /sorry", "SaySorry");
register_clcmd("say_team /sorry", "SaySorry");
#endif
register_clcmd("say", "SayChat");
register_clcmd("say_team", "SayChat");

register_srvcmd("uсc_flush", "SrvCmdFlush");

register_menucmd(register_menuid("UCC Menu"), 1023, "MenuHandler");

set_task(60.0, "CheckBlockedUsers", .flags = "b");
}

public plugin_cfg()
{
SQL_Init();
#if defined CHATS_BY_STATS && defined BLOCK_CHATS_INFO && VOICE_CONTROL_BY_STATS == 3
set_task(1.0, "task__aes_get_level_name"); // fucking serfreeman1337. govnocoder
#endif
g_tAllowCmds = TrieCreate();
for(new i; i < sizeof g_AllowCommands; ++i)
TrieSetCell(g_tAllowCmds, g_AllowCommands[i], i);
}
#if defined CHATS_BY_STATS && defined BLOCK_CHATS_INFO && VOICE_CONTROL_BY_STATS == 3
public task__aes_get_level_name()
{
aes_get_level_name(MIN_FRAGS, g_szAesLevelName, charsmax(g_szAesLevelName), LANG_SERVER);
}
#endif
public client_putinserver(id)
{
if(is_user_bot(id) || is_user_hltv(id))
return;

arrayset(g_iMutePlayer[id], 0, sizeof g_iMutePlayer[]);
g_BlockInfo[id][expired] = -1;
g_BlockInfo[id][reason][0] = EOS;
g_BlockInfo[id][admin_steamid][0]= EOS;
g_BlockInfo[id][GagBlockType] = NONE;
#if defined CHATS_BY_STATS
if(!get_chats_access(id))
{
set_user_block(id, ALL_CHATS);
#if defined BLOCK_TEXT_CHAT_BY_STATS
g_BlockInfo[id][GagBlockType] = STATS;
#endif
}
#endif
new szIP[16], szAuth[32];
get_user_ip(id, szIP, charsmax(szIP), 1);
get_user_authid(id, szAuth, charsmax(szAuth));

formatex(g_szQuery, charsmax(g_szQuery),
"SELECT `expired_time`, `reason`, `admin_steamid`, `block_type` FROM `ucc_gag` WHERE (`ip` = '%s' OR `steamid` = '%s') AND `expired_time` >= '0'",
szIP, szAuth
);

g_Data[0] = LOAD_PLAYER;
g_Data[1] = id;
SQL_ThreadQuery(g_hTuple, "SQL_ThreadsHandler", g_szQuery, g_Data, sizeof(g_Data));
}
#if defined MUTEMENU
#if defined _reapi_included
public CanPlayerHearPlayer_Pre(const iReciever, const iSender)
{
if(iSender != iReciever)
{
if(g_iMutePlayer[iReciever][iSender])
{
SetHookChainReturn(ATYPE_INTEGER, false);
return HC_SUPERCEDE;
}
}
return HC_CONTINUE;
}
#else
public SetClientListening_Pre(iReciever, iSender)
{
if(iSender != iReciever)
{
if(g_iMutePlayer[iReciever][iSender])
{
engfunc(EngFunc_SetClientListening, iReciever, iSender, false);
forward_return(FMV_CELL, false);
return FMRES_SUPERCEDE;
}
}
return FMRES_IGNORED;
}
#endif
#endif
#if defined SORRY
public SaySorry(id)
{
if(is_blocked_text_chat(id))
{
static iFloodTime[MAX_PLAYERS + 1], systime;
if(iFloodTime[id] > (systime = get_systime()))
ChatColor(id, 0, MSG_SORRY_FLOOD, PREFIX, iFloodTime[id] - systime);
else
{
new 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)
ChatColor(pl[i], 0, MSG_SORRY_ADMIN, PREFIX, sName, g_BlockInfo[id][reason]);
}

iFloodTime[id] = systime + SORRYTIME;
}
}
return PLUGIN_HANDLED;
}
#endif
public SayChat(id)
{
#if defined CHATS_BY_STATS && defined BLOCK_TEXT_CHAT_BY_STATS
if(!is_blocked_text_chat(id) && g_BlockInfo[id][GagBlockType] != STATS)
#else
if(!is_blocked_text_chat(id))
#endif
return PLUGIN_CONTINUE;

new sMessage[128];
read_args(sMessage, charsmax(sMessage));
remove_quotes(sMessage);

if(TrieKeyExists(g_tAllowCmds, sMessage))
return PLUGIN_CONTINUE;
else if(is_blocked_text_chat(id))
{
new sName[32], ost;
get_user_name(id, sName, charsmax(sName));
ChatColor(id, 0, MSG_CHAT_IS_BLOCKED, PREFIX, sName, g_BlockInfo[id][reason]);

if(g_BlockInfo[id][expired] > 0)
{
if((ost = g_BlockInfo[id][expired] - get_systime()) / 60 > 0)
ChatColor(id, 0, MSG_BLOCK_EXPIRED_TIME, PREFIX, ost / 60);
else ChatColor(id, 0, MSG_BLOCK_EXPIRED, PREFIX);
}

ChatColor(id, 0, MSG_SAY_SORRY, PREFIX);
}
#if defined CHATS_BY_STATS && defined BLOCK_CHATS_INFO
else
{
ChatColor(id, 0, MSG_BLOCK_CHATS0, PREFIX);
#if VOICE_CONTROL_BY_STATS == 3
ChatColor(id, 0, MSG_BLOCK_CHATS2, PREFIX, g_szAesLevelName);
#else
ChatColor(id, 0, MSG_BLOCK_CHATS3, PREFIX, g_iFragStats[id], MIN_FRAGS);
#endif
}
#endif
return PLUGIN_HANDLED;
}
#if defined CHATS_BY_STATS
public CBasePlayer_Spawn_Post(const id)
{
if(!is_user_connected(id))
return;
if(get_chats_access(id))
{
if(is_blocked_voice_chat(id))
{
VTC_UnmuteClient(id);
#if defined BLOCK_TEXT_CHAT_BY_STATS
g_BlockInfo[id][GagBlockType] = (g_BlockInfo[id][GagBlockType] > STATS) ? g_BlockInfo[id][GagBlockType] : NONE;
#endif
}
}
#if defined BLOCK_CHATS_INFO
else if(g_BlockInfo[id][GagBlockType] == STATS)
{
#if defined BLOCK_TEXT_CHAT_BY_STATS
ChatColor(id, 0, MSG_BLOCK_CHATS0, PREFIX);
#else
ChatColor(id, 0, MSG_BLOCK_CHATS1, PREFIX);
#endif
#if VOICE_CONTROL_BY_STATS == 3
ChatColor(id, 0, MSG_BLOCK_CHATS2, PREFIX, g_szAesLevelName);
#else
ChatColor(id, 0, MSG_BLOCK_CHATS3, PREFIX, g_iFragStats[id], MIN_FRAGS);
#endif
}
#endif
}
#endif
public SrvCmdFlush()
{
g_Data[0] = DROP_TABLE;
SQL_ThreadQuery(g_hTuple, "SQL_ThreadsHandler", "TRUNCATE `ucc_gag`", g_Data, sizeof(g_Data));

for(new id; id < sizeof g_BlockInfo; ++id)
{
g_BlockInfo[id][expired] = -1;
g_BlockInfo[id][reason][0] = EOS;
g_BlockInfo[id][admin_steamid][0]= EOS;
g_BlockInfo[id][GagBlockType] = NONE;
}

log_amx("%s [v: %s][a: %s] flushed all gags", PNAME, VERSION, AUTHOR);
}

public CheckBlockedUsers()
{
get_players(pl, pnum);
for(new i, sys = get_systime(); i < pnum; ++i)
{
if(g_BlockInfo[pl[i]][expired] > 0)
{
if(sys > g_BlockInfo[pl[i]][expired])
user_unblock(pl[i]);
}
}
}

public ClCmdGagMenu(id)
{
if(get_user_flags(id) & GAG_ACCESS)
{
g_iMenuInfo[id][SelectTime] = 0;
g_iMenuInfo[id][Pos] = 0;
g_iMenuInfo[id][Menu] = any:GAG;
g_iMenuInfo[id][SelectType] = any:DEFAULT_BLOCK_TYPE;

ShowMenu(id, 0);
}

return PLUGIN_HANDLED;
}

public ClCmdMuteMenu(id)
{
g_iMenuInfo[id][Pos] = 0;
g_iMenuInfo[id][Menu] = any:MUTE;

ShowMenu(id, 0);
return PLUGIN_HANDLED;
}

const MENU_ITEMS = 5;
ShowMenu(id, iPos)
{
new sAuth[25];
new start, end;
new iLen, sMenu[512];
new iKeys = MENU_KEY_0|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8;
get_players(g_arrPlayers[id], pnum, "ch");
get_user_authid(id, sAuth, charsmax(sAuth));

start = iPos * MENU_ITEMS;
end = start + MENU_ITEMS;

switch(g_iMenuInfo[id][Menu])
{
case GAG: iLen = formatex(sMenu, charsmax(sMenu), "\d[\rAMX Gag\d] \yВыберите игрока\w\R%d/%d^n^n", iPos + 1, (pnum / MENU_ITEMS + ((pnum % MENU_ITEMS) ? 1 : 0)));
case MUTE:iLen = formatex(sMenu, charsmax(sMenu), "\d[\rMute\d] \yВыберите игрока\w\R%d/%d^n^n", iPos + 1, (pnum / MENU_ITEMS + ((pnum % MENU_ITEMS) ? 1 : 0)));
}

if(start >= pnum)
start = iPos = g_iMenuInfo[id][Pos] = 0;
if(end > pnum)
end = pnum;

switch(g_iMenuInfo[id][Menu])
{
case GAG:
{
#if defined SUPERADMIN
for(new i = start, bool:superadmin = bool:(get_user_flags(id) & SUPERADMIN), sName[32], plr, a; i < end; ++i)
#else
for(new i = start, sName[32], plr, a; i < end; ++i)
#endif
{
plr = g_arrPlayers[id][i];
get_user_name(plr, sName, charsmax(sName));

if(id == plr)
iLen += formatex(sMenu[iLen], charsmax(sMenu) - iLen, "\r%d. \d%s \y[\rЭто Вы\y]^n", ++a, sName);
#if defined SUPERADMIN
else if(!superadmin && get_user_flags(plr) & ADMIN_IMMUNITY)
#else
else if(get_user_flags(plr) & ADMIN_IMMUNITY)
#endif
iLen += formatex(sMenu[iLen], charsmax(sMenu) - iLen, "\r%d. \d%s \y[\rImmunity\y]^n", ++a, sName);
#if defined CHATS_BY_STATS
else if(g_BlockInfo[plr][GagBlockType] == STATS)
iLen += formatex(sMenu[iLen], charsmax(sMenu) - iLen, "\r%d. \d%s \y[\rLowStats\y]^n", ++a, sName);
#endif
else if(g_BlockInfo[plr][GagBlockType] > NONE)
{
#if defined SUPERADMIN
if(superadmin || strcmp(g_BlockInfo[plr][admin_steamid], sAuth) == 0)
{
iKeys |= (1 << a++);
iLen += formatex(sMenu[iLen], charsmax(sMenu) - iLen, "\r%d. \w%s \d[\yUngag\d]^n", a, sName);
}
else iLen += formatex(sMenu[iLen], charsmax(sMenu) - iLen, "\r%d. \d%s^n", ++a, sName);
#else
iKeys |= (1 << a++);
iLen += formatex(sMenu[iLen], charsmax(sMenu) - iLen, "\r%d. \w%s \d[\yUngag\d]^n", a, sName);
#endif
}
else
{
iKeys |= (1 << a++);
iLen += formatex(sMenu[iLen], charsmax(sMenu) - iLen, "\r%d. \w%s%s^n", a, sName, VTC_IsClientSpeaking(plr) ? " \d[\rSpeaking\d]" : "");
}
}

if(!g_BlockTimes[g_iMenuInfo[id][SelectTime]])
iLen += formatex(sMenu[iLen], charsmax(sMenu) - iLen, "^n\r6. \wGag\d'\wнуть \rнавсегда^n");
else iLen += formatex(sMenu[iLen], charsmax(sMenu) - iLen, "^n\r6. \wGag\d'\wнуть на \y%d \wмин^n", g_BlockTimes[g_iMenuInfo[id][SelectTime]]);

iLen += formatex(sMenu[iLen], charsmax(sMenu) - iLen, "\r7. \wБлокировать \y%s^n", g_BlockTypes[g_iMenuInfo[id][SelectType]]);
iLen += formatex(sMenu[iLen], charsmax(sMenu) - iLen, "\r8. \wReason: \r%s^n^n", g_Reasons[g_iMenuInfo[id][SelectReason]]);
}
case MUTE:
{
for(new i = start, sName[32], plr, a; i < end; ++i)
{
plr = g_arrPlayers[id][i];
get_user_name(plr, sName, charsmax(sName));

if(id == plr)
iLen += formatex(sMenu[iLen], charsmax(sMenu) - iLen, "\r%d. \d%s \y[\rЭто Вы\y]^n", ++a, sName);
else
{
iKeys |= (1 << a++);
iLen += formatex(sMenu[iLen], charsmax(sMenu) - iLen, "\r%d. \w%s%s^n", a, sName, g_iMutePlayer[id][plr] ? " \d[\yMuted\d]" : "");
}
}

iLen += formatex(sMenu[iLen], charsmax(sMenu) - iLen, "^n\r7. \wЗаглушить \rвсех^n\r8. \wСнять Mute со \rвсех^n^n");
}
}

if(end != pnum)
{
formatex(sMenu[iLen], charsmax(sMenu) - iLen, "\r9. \yДалее^n\r0. \r%s", iPos ? "Назад" : "Выход");
iKeys |= MENU_KEY_9;
}
else formatex(sMenu[iLen], charsmax(sMenu) - iLen, "\r0. \r%s", iPos ? "Назад" : "Выход");

show_menu(id, iKeys, sMenu, -1, "UCC Menu");
return PLUGIN_HANDLED;
}

public MenuHandler(id, iKey)
{
switch(iKey)
{
case 5:
{
switch(g_iMenuInfo[id][Menu])
{
case GAG:
{
if(++g_iMenuInfo[id][SelectTime] > charsmax(g_BlockTimes))
g_iMenuInfo[id][SelectTime] = 0;

ShowMenu(id, g_iMenuInfo[id][Pos]);
}
case MUTE:
MuteHandler(id, g_arrPlayers[id][g_iMenuInfo[id][Pos] * MENU_ITEMS + iKey]);
}
}
case 6:
{
switch(g_iMenuInfo[id][Menu])
{
case GAG:
{
if(++g_iMenuInfo[id][SelectType] > charsmax(g_BlockTypes))
g_iMenuInfo[id][SelectType] = 0;

ShowMenu(id, g_iMenuInfo[id][Pos]);
}
case MUTE:
{
arrayset(g_iMutePlayer[id], 1, sizeof g_iMutePlayer[]);
ChatColor(id, 0, MSG_MUTE_ALL_PLAYERS, PREFIX);
}
}

}
case 7:
{
switch(g_iMenuInfo[id][Menu])
{
case GAG:
{
if(++g_iMenuInfo[id][SelectReason] > charsmax(g_Reasons))
g_iMenuInfo[id][SelectReason] = 0;

ShowMenu(id, g_iMenuInfo[id][Pos]);
}
case MUTE:
{
arrayset(g_iMutePlayer[id], 0, sizeof g_iMutePlayer[]);
ChatColor(id, 0, MSG_UNMUTE_ALL_PLAYERS, PREFIX);
}
}
}
case 8: ShowMenu(id, ++g_iMenuInfo[id][Pos]);
case 9:
{
if(g_iMenuInfo[id][Pos])
ShowMenu(id, --g_iMenuInfo[id][Pos]);
}
default:
{
switch(g_iMenuInfo[id][Menu])
{
case GAG:
{
GagHandler(
id,
g_arrPlayers[id][g_iMenuInfo[id][Pos] * MENU_ITEMS + iKey],
g_BlockTimes[g_iMenuInfo[id][SelectTime]],
g_Reasons[g_iMenuInfo[id][SelectReason]],
any:(g_iMenuInfo[id][SelectType] + 1)
);
}
case MUTE:
{
MuteHandler(id, g_arrPlayers[id][g_iMenuInfo[id][Pos] * MENU_ITEMS + iKey]);
}
}
}
}
return PLUGIN_HANDLED;
}

GagHandler(id, player, blocktime, blockreason[REASON_LENGTH], BLOCK_TYPES:block_type)
{
if(!is_user_connected(player))
return;

new sNameAdmin[32], sNamePlayer[32];
get_user_name(id, sNameAdmin, charsmax(sNameAdmin));
get_user_name(player, sNamePlayer, charsmax(sNamePlayer));

if(g_BlockInfo[player][GagBlockType] > STATS)
{
user_unblock(player);

ChatColor(0, player, MSG_CHAT_UNBLOCK_ALL, PREFIX, sNamePlayer, sNameAdmin);
ChatColor(player, 0, MSG_CHAT_UNBLOCK_PL, PREFIX, sNamePlayer, sNameAdmin);
}
else
{
user_block(player, id, blocktime, blockreason, block_type);

new blocktimeinfo[32];
if(!blocktime)
formatex(blocktimeinfo, charsmax(blocktimeinfo), "навсегда");
else formatex(blocktimeinfo, charsmax(blocktimeinfo), "на %d минут", blocktime);

switch(block_type)
{
case TEXT_CHAT:
{
ChatColor(0, player, MSG_TEXTCHAT_BLOCK_ALL, PREFIX, sNameAdmin, sNamePlayer, blocktimeinfo, blockreason);
ChatColor(player, 0, MSG_TEXTCHAT_BLOCK_PL, PREFIX, sNamePlayer, sNameAdmin, blocktimeinfo, blockreason);
}
case VOICE_CHAT:
{
ChatColor(0, player, MSG_VOICECHAT_BLOCK_ALL, PREFIX, sNameAdmin, sNamePlayer, blocktimeinfo, blockreason);
ChatColor(player, 0, MSG_VOICECHAT_BLOCK_PL, PREFIX, sNamePlayer, sNameAdmin, blocktimeinfo, blockreason);
}
case ALL_CHATS:
{
ChatColor(0, player, MSG_ALLCHATS_BLOCK_ALL, PREFIX, sNameAdmin, sNamePlayer, blocktimeinfo, blockreason);
ChatColor(player, 0, MSG_ALLCHATS_BLOCK_PL, PREFIX, sNamePlayer, sNameAdmin, blocktimeinfo, blockreason);
}
}
}
ShowMenu(id, g_iMenuInfo[id][Pos]);
}

MuteHandler(id, player)
{
if(!is_user_connected(player))
return;

new sNamePlayer[32];
get_user_name(player, sNamePlayer, charsmax(sNamePlayer));

g_iMutePlayer[id][player] = !g_iMutePlayer[id][player];
ChatColor(id, 0, g_iMutePlayer[id][player] ? MSG_MUTE_PLAYER : MSG_UNMUTE_PLAYER, PREFIX, sNamePlayer);

ShowMenu(id, g_iMenuInfo[id][Pos]);
}

user_block(id, admin, blocktime, blockreason[REASON_LENGTH], BLOCK_TYPES:block_type)
{
set_user_block(id, block_type);

new szName[64], szIP[16], szAuth[32];
get_user_name(id, szName, charsmax(szName));
get_user_ip(id, szIP, charsmax(szIP), 1);
get_user_authid(id, szAuth, charsmax(szAuth));

new szAdminName[64], szAdminIP[16], szAdminAuth[32];
get_user_name(admin, szAdminName, charsmax(szAdminName));
get_user_ip(admin, szAdminIP, charsmax(szAdminIP), 1);
get_user_authid(admin, szAdminAuth, charsmax(szAdminAuth));

new iSystime = get_systime();
g_BlockInfo[id][expired] = !blocktime ? 0 : iSystime + blocktime * 60;
formatex(g_BlockInfo[id][reason], charsmax(g_BlockInfo[][reason]), blockreason);
formatex(g_BlockInfo[id][admin_steamid], charsmax(g_BlockInfo[][admin_steamid]), szAdminAuth);

mysql_escape_string(szName, charsmax(szName));
mysql_escape_string(szAdminName, charsmax(szAdminName));
mysql_escape_string(g_BlockInfo[id][reason], charsmax(g_BlockInfo[][reason]));

formatex(g_szQuery, charsmax(g_szQuery),
"INSERT INTO `ucc_gag` (`name`, `steamid`, `ip`, `admin_name`, `admin_steamid`, `admin_ip`, `create_time`, `expired_time`, `reason`, `block_type`) \
VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%d', '%d', '%s', '%d') \
ON DUPLICATE KEY UPDATE `name` = '%s', `ip` = '%s', `admin_name` = '%s', `admin_steamid` = '%s', `admin_ip` = '%s', `create_time` = '%d', `expired_time` = '%d', `reason` = '%s', `block_type` = '%d'",
szName, szAuth, szIP, szAdminName, szAdminAuth, szAdminIP, iSystime, g_BlockInfo[id][expired], g_BlockInfo[id][reason], any:block_type,
szName, szIP, szAdminName, szAdminAuth, szAdminIP, iSystime, g_BlockInfo[id][expired], g_BlockInfo[id][reason], any:block_type
);

g_Data[0] = SAVE_BLOCK;
SQL_ThreadQuery(g_hTuple, "SQL_ThreadsHandler", g_szQuery, g_Data, sizeof(g_Data));
}

user_unblock(id)
{
if(is_blocked_voice_chat(id))
VTC_UnmuteClient(id);

g_BlockInfo[id][expired] = -1;
g_BlockInfo[id][reason][0] = EOS;
g_BlockInfo[id][admin_steamid][0]= EOS;
g_BlockInfo[id][GagBlockType] = NONE;

new szIP[16], szAuth[32];
get_user_ip(id, szIP, charsmax(szIP), 1);
get_user_authid(id, szAuth, charsmax(szAuth));

formatex(g_szQuery, charsmax(g_szQuery), "UPDATE `ucc_gag` SET `expired_time` = '-1' WHERE `ip` = '%s' OR `steamid` = '%s'", szIP, szAuth);

g_Data[0] = REMOVE_BLOCK;
SQL_ThreadQuery(g_hTuple, "SQL_ThreadsHandler", g_szQuery, g_Data, sizeof(g_Data));
}

SQL_Init()
{
SQL_SetAffinity("mysql");
g_hTuple = SQL_MakeDbTuple(DB_HOST, DB_USER, DB_PASS, DB_NAME, 1);

new errcode, errstr[128], Handle:hTest = SQL_Connect(g_hTuple, errcode, errstr, charsmax(errstr));
if(hTest == Empty_Handle)
{
#if AMXX_VERSION_NUM < 183
new szError[128]; formatex(szError, charsmax(szError), "[SQL ERROR #%d] %s", errcode, errstr);
set_fail_state(szError);
#else
set_fail_state("[SQL ERROR #%d] %s", errcode, errstr);
#endif
}
else
{
SQL_FreeHandle(hTest);
#if AMXX_VERSION_NUM >= 183
SQL_SetCharset(g_hTuple, "utf8");
#endif
new iClearPeriod = get_systime() - 86400 * CLEAR_PERIOD;
// superfix compile for amxx 1.8.2
new iLen = formatex(g_szQuery, charsmax(g_szQuery),
"CREATE TABLE IF NOT EXISTS `ucc_gag` ( \
`id` smallint(6) NOT NULL AUTO_INCREMENT, \
`name` varchar(32) NOT NULL, \
`steamid` varchar(32) NOT NULL, \
`ip` varchar(16) NOT NULL, \
`admin_name` varchar(32) NOT NULL, \
`admin_steamid` varchar(32) NOT NULL, \
`admin_ip` varchar(32) NOT NULL, \
`create_time` int(11) NOT NULL, ");
formatex(g_szQuery[iLen], charsmax(g_szQuery),
"`expired_time` int(11) NOT NULL, \
`reason` varchar(%d) NOT NULL, \
`block_type` int(11) NOT NULL, \
PRIMARY KEY (`id`), \
UNIQUE KEY `steamid` (`steamid`) \
)ENGINE=InnoDB DEFAULT CHARSET=utf8; \
DELETE FROM `ucc_gag` WHERE (`expired_time` < '%d' AND `expired_time` > '0') OR (`expired_time` = '-1' AND `create_time` < '%d');",
REASON_LENGTH, iClearPeriod, iClearPeriod);

g_Data[0] = SQL_INIT;
SQL_ThreadQuery(g_hTuple, "SQL_ThreadsHandler", g_szQuery, g_Data, sizeof(g_Data));
}
}

public SQL_ThreadsHandler(failstate, Handle:query, err[], errcode, data[], datasize)
{
switch(failstate)
{
case TQUERY_CONNECT_FAILED, TQUERY_QUERY_FAILED:
{
log_amx("[SQL ERROR #%d] %s", errcode, err);
return;
}
}

switch(data[0])
{
case SQL_INIT, DROP_TABLE, SAVE_BLOCK, REMOVE_BLOCK: {}
case LOAD_PLAYER:
{
if(SQL_NumResults(query))
{
new id = data[1];

g_BlockInfo[id][expired] = SQL_ReadResult(query, 0);
g_BlockInfo[id][GagBlockType] = any:SQL_ReadResult(query, 3);
SQL_ReadResult(query, 1, g_BlockInfo[id][reason], charsmax(g_BlockInfo[][reason]));
SQL_ReadResult(query, 2, g_BlockInfo[id][admin_steamid], charsmax(g_BlockInfo[][admin_steamid]));

set_user_block(id, g_BlockInfo[id][GagBlockType]);
}
}
}
}

public native_ucc_is_client_gaged(plugin, params)
{
enum { index = 1, exp_time, gag_reason, gag_type };

new id = get_param(index);

if(is_user_connected(id))
{
set_param_byref(exp_time, g_BlockInfo[id][expired]);
set_string(gag_reason, g_BlockInfo[id][reason], charsmax(g_BlockInfo[][reason]));

if(params > 3)
set_param_byref(gag_type, any:g_BlockInfo[id][GagBlockType]);

return (g_BlockInfo[id][GagBlockType] > NONE);
}

log_error(AMX_ERR_NATIVE, "Client %d not connected or index out of range!", id);
return -1;
}

public native_ucc_set_client_gag(plugin, params)
{
enum { index = 1, admin_id, block_time, gag_reason, gag_type };

new id = get_param(index);
new admin = get_param(admin_id);
new type = (params > 4) ? get_param(gag_type) : any:ALL_CHATS;

if(!is_user_connected(id))
{
log_error(AMX_ERR_NATIVE, "Client %d not connected or index out of range!", id);
return 0;
}
if(!is_user_connected(admin))
admin = 0;

new szReason[REASON_LENGTH];
get_string(gag_reason, szReason, charsmax(szReason));

user_block(id, admin, get_param(block_time), szReason, any:type);
return 1;
}
#if defined MUTEMENU
public native_ucc_is_client_muted(plugin, params)
{
enum { index = 1, player };

new id = get_param(index);
new victim = get_param(player);

if(!is_user_connected(id))
{
log_error(AMX_ERR_NATIVE, "Client %d not connected or index out of range!", id);
return -1;
}
if(!is_user_connected(victim))
{
log_error(AMX_ERR_NATIVE, "Client %d not connected or index out of range!", victim);
return -1;
}

return g_iMutePlayer[id][victim];
}

public native_ucc_set_client_muted(plugin, params)
{
enum { index = 1, player, muted };

new id = get_param(index);
new victim = get_param(player);
new set_mute = get_param(muted);

if(!is_user_connected(id))
{
log_error(AMX_ERR_NATIVE, "Client %d not connected or index out of range!", id);
return 0;
}
if(!is_user_connected(victim))
{
log_error(AMX_ERR_NATIVE, "Client %d not connected or index out of range!", victim);
return 0;
}


g_iMutePlayer[id][victim] = (set_mute > 0) ? 1 : 0;
return 1;
}
#endif
public plugin_end()
{
SQL_FreeHandle(g_hTuple);
TrieDestroy(g_tAllowCmds);
}

set_user_block(id, BLOCK_TYPES:block_type)
{
g_BlockInfo[id][GagBlockType] = block_type;

switch(block_type)
{
case VOICE_CHAT, ALL_CHATS:
{
VTC_MuteClient(id);
client_cmd(id, "-voicerecord");
}
}
}
#if defined CHATS_BY_STATS
bool:get_chats_access(id)
{
if(get_user_flags(id) & ADMIN_FLAG)
return true;
#if VOICE_CONTROL_BY_STATS == 0
new st[8], bh[HIT_RIGHTLEG + 1];
if(!get_user_stats(id, st, bh))
return false;
#endif
#if VOICE_CONTROL_BY_STATS == 1
new st[22];
if(csstats_get_user_stats(id, st) <= 0)
return false;
#endif
#if VOICE_CONTROL_BY_STATS == 2
new st[8], bh[HIT_RIGHTLEG + 1];
if(!get_user_stats_sql(id, st, bh))
return false;
#endif
#if VOICE_CONTROL_BY_STATS == 3
new st[1]; st[0] = aes_get_player_level(id);
if((st[0] = aes_get_player_level(id)) == -1)
return false;
#endif
#if defined BLOCK_CHATS_INFO
g_iFragStats[id] = st[0];
#endif
return (st[0] < MIN_FRAGS) ? false : true;
}
#endif
stock ChatColor(id, id2, const szMessage[], any:...)
{
new szMsg[190];
vformat(szMsg, charsmax(szMsg), szMessage, 4);

if(id)
{
client_print_color(id, print_team_default, szMsg);
}
else
{
get_players(pl, pnum, "c");
for(new i; i < pnum; ++i)
{
if(pl[i] != id2)
{
client_print_color(pl[i], print_team_default, szMsg);
}
}
}
}

#if !defined replace_string
#define replace_string replace_all
#endif
stock mysql_escape_string(output[], len)
{
static const szReplaceIn[][] = { "\\", "\0", "\n", "\r", "\x1a", "'", "^"" };
static const szReplaceOut[][] = { "\\\\", "\\0", "\\n", "\\r", "\Z", "\'", "\^"" };
for(new i; i < sizeof szReplaceIn; i++)
replace_string(output, len, szReplaceIn[i], szReplaceOut[i]);
}
Проблема с amx_gagmenu оно просто не работает
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу