- Ошибка
-
нет
- ОС
- Linux
- Amx Mod X
-
AMX Mod X 1.9.0.5263 (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: Oct 27 2019 16:23:31
Built from: https://github.com/alliedmodders/amxmodx/commit/15a14a0
Build ID: 5263:15a14a0
Core mode: JIT+ASM32
- Билд
-
Protocol version 48
Exe version 1.1.2.7/Stdio (cstrike)
ReHLDS version: 3.7.0.695-dev
Build date: 15:54:29 Apr 6 2020 (2186)
Build from: https://github.com/dreamstalker/rehlds/commit/7513e71
- ReGamedll
-
ReGameDLL version: 5.16.0.460-dev
Build date: 10:11:49 May 2 2020
Build from: https://github.com/s1lentq/ReGameDLL_CS/commit/4f72525
- Версия Metamod
-
Metamod-r v1.3.0.128, API (5:13)
Metamod-r build: 17:47:54 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] Reunion RUN - reunion.so v0.1.0.135 ini Start Never
[ 2] AMX Mod X RUN - amxmodx.so v1.9.0.5263 ini Start ANY
[ 3] Rechecker RUN - rechecker_mm_i386.so v2.5 ini ANY
[ 4] ReAuthCheck RUN - reauthcheck_mm_i386.so v0.1.6 ini Start Never
[ 5] VoiceTranscoder RUN - VoiceTranscoder.so v2017RC5 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] MySQL RUN - mysql_amxx_i386.so v1.9.0.5263 pl2 ANY
[10] Fun RUN - fun_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
[11] CStrike RUN - cstrike_amxx_i386.so v1.8.2 pl2 ANY ANY
[12] CSX RUN - csx_amxx_i386.so v1.8.2 pl2 ANY ANY
[13] ReAPI RUN - reapi_amxx_i386.so v5.12.0.192-dev pl2 ANY Never
[14] SQLite RUN - sqlite_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
[15] FakeMeta RUN - fakemeta_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
[16] Ham Sandwich RUN - hamsandwich_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
[17] Engine RUN - engine_amxx_i386.so v1.9.0.5263 pl2 ANY ANY
17 plugins, 17 running
- Список плагинов
-
Currently loaded plugins:
name version author file status
[ 1] Admin Loader v3.5 neygomon admin_loader.am running
[ 2] FreshBans v1.4.3b kanagava fresh_bans_143_ running
[ 3] CSStatsX SQL v0.7.4+2 serfreeman1337 csstatsx_sql.am running
[ 4] Lite TeamBalancer v1.20 neygomon lite_balancer.a running
[ 5] Say me and Say hp v1.4 neygomon sayme.amxx running
[ 6] Chats Additions Core v1.0.0-beta Sergey Shorokhov ChatAdditions_C running
[ 7] AES: StatsX v0.5.9 [REA serfreeman1337/s aes_statsx_cstr running
[ 8] Yet Another Voteban v1.8 AndrewZ/voed yet_another_vot running
[ 9] Auto-Give Privileges v1.0 SerGrib night_vip.amxx running
[ 10] Change Game Name v1.2 GoldSrc Team game_name.amxx running
[ 11] Damager Advanced v1.1.2 Radius (based on damager_advance running
[ 12] amxmodmenu v2.0 null amxmodmenu.amxx running
[ 13] [ReAPI] Admin Models v0.0.2 Vaqtincha reapi_admin_mod running
[ 14] Steаm Bonus v1.1 ill+F@nToM steam_bonus.amx running
[ 15] AFK Control ReNew v1.2(a) neygomon afk_control.amx running
[ 16] Admin Commands v1.9.0.5263 AMXX Dev Team admincmd.amxx running
[ 17] Slots Reservation v1.9.0.5263 AMXX Dev Team adminslots.amxx running
[ 18] Commands Menu v1.9.0.5263 AMXX Dev Team cmdmenu.amxx running
[ 19] Players Menu v1.9.0.5263 AMXX Dev Team plmenu.amxx running
[ 20] Maps Menu v1.9.0.5263 AMXX Dev Team mapsmenu.amxx running
[ 21] Admin Chat v1.9.0.5263 AMXX Dev Team adminchat.amxx running
[ 22] Admin Votes v1.9.0.5263 AMXX Dev Team adminvote.amxx running
[ 23] TimeLeft v1.9.0.5263 AMXX Dev Team timeleft.amxx running
[ 24] Pause Plugins v1.9.0.5263 AMXX Dev Team pausecfg.amxx running
[ 25] Stats Configuration v1.9.0.5263 AMXX Dev Team statscfg.amxx running
[ 26] Restrict Weapons v1.8.2 AMXX Dev Team restmenu.amxx running
[ 27] List Of Admins Online v1.0.8 wellasgood List_Of_Admins_ running
[ 28] Autoresponder/Advertis v0.5 MaximusBrood ad_manager.amxx running
[ 29] Kills Counter v0.3 serfreeman1337 kills_counter.a running
[ 30] resetscore(ReAPI) v1.0 Phantom resetscore.amxx running
[ 31] Parachute Lite [ReAPI] v11.0 Leo_[BH] parachute_lite. running
[ 32] Mode 2x2 v2.5re s1lent mode.amxx running
[ 33] Style C4 Timer v3.1 OciXCrom crx_c4timer.amx running
[ 34] Map Manager v2.5.61 Mistrick mapmanager.amxx running
[ 35] [ReAPI] No Team Flash v0.0.3 Vaqtincha no_team_flash.a running
[ 36] Admin ESP v1.5b_mini KoST admin_esp_mini. running
[ 37] Advanced Kill Assists v1.2c Xelson next21_kill_ass running
[ 38] Vampire v1.0c Shalfey vampire.amxx running
[ 39] Top Round Damage v1.0.4 ReAP Dager* *.* -G- damage_round.am running
[ 40] Auto recording demo v2.0 IzI | Bonaqua (R amx_autodemorec running
[ 41] Spect Bot v1.2 SKAJIbnEJIb & Bo SpectBot.amxx running
[ 42] Server Menu [INI] v1.0 Leo_[BH] server_menu.amx running
[ 43] Ping Control v1.31 neygomon Ping_Control.am running
[ 44] Lite Translit v2.8 neygomon lite_translit.a running
[ 45] [CA] Gag v1.0.0-beta Sergey Shorokhov CA_Gag.amxx debug
[ 46] [CA] Mute menu v1.0.0-beta Sergey Shorokhov CA_Mute.amxx debug
[ 47] Advanced Experience Sy v0.5.9 [REA serfreeman1337/s aes_main.amxx running
[ 48] AES: CStrike Addon v0.5.9 [REA serfreeman1337/s aes_exp_cstrike running
[ 49] AES: Informer v0.5.9 [REA serfreeman1337/s aes_informer.am running
[ 50] AES: Admin Tools v0.5.9 [REA serfreeman1337/s aes_exp_editor. running
[ 51] AES: Bonus System v0.5.9 Vega serfreeman1337/s aes_bonus_syste running
[ 52] AES: Bonus CSTRIKE v0.5.9.1 [R serfreeman1337/s aes_bonus_cstri running
[ 53] V.I.P Custom Weapons v1.0.0 Vaqtincha vip_custom.amxx debug
[ 54] V.I.P Custom KNIFE v1.0.0 Vaqtincha custom_knife.am debug
[ 55] V.I.P Custom DEAGLE v1.0.0 Vaqtincha custom_deagle.a debug
[ 56] V.I.P Custom M4A1 v1.0.0 Vaqtincha custom_m4a1.amx debug
[ 57] V.I.P Custom AK-47 v1.0.0 Vaqtincha custom_ak47.amx debug
[ 58] V.I.P Custom AWP v1.0.0 Vaqtincha custom_awp.amxx debug
58 plugins, 58 running
- Автор плагина
- Sergey Shorokhov
- Версия плагина
- 1.0.0-beta
- Исходный код
-
// #define DEBUG
// #define CHOOSE_STORAGE [0 .. 3]
#include <amxmodx>
#include <amxmisc>
#include <time>
#include <ChatAdditions>
#include <CA_GAG_API>
#pragma semicolon 1
#pragma ctrlchar '\'
#pragma dynamic 524288
/* ----- START SETTINGS----- */
new const MSG_PREFIX[] = "\4[GAG]\1";
/**
* Database type for storage gags
* DB_NVault,
* DB_JSON, // TODO:
* DB_MySQL,
* DB_SQLite
*/
#define DATABASE_TYPE DB_MySQL
#define FLAGS_ACCESS ( ADMIN_KICK )
#define FLAGS_IMMUNITY ( ADMIN_IMMUNITY )
/* ----- END OF SETTINGS----- */
enum any: TIME_CONST_s (+=1) { FOREVER = -1 };
new g_aCurrentGags[MAX_PLAYERS + 1][gag_s];
static g_aGags_AdminEditor[MAX_PLAYERS + 1][gag_s];
static Array: g_aReasons, g_iArraySize_Reasons;
static Array: g_aGagTimes, g_iArraySize_GagTimes;
#if defined DEBUG && defined CHOOSE_STORAGE
#undef DATABASE_TYPE
#define DATABASE_TYPE CHOOSE_STORAGE
#endif
#if defined DATABASE_TYPE
#if DATABASE_TYPE == DB_NVault
#include <ChatAdditions_inc/_NVault>
#elseif DATABASE_TYPE == DB_JSON
// #include <ChatAdditions_inc/_JSON>
#elseif DATABASE_TYPE == DB_MySQL
#include <ChatAdditions_inc/_MySQL>
#elseif DATABASE_TYPE == DB_SQLite
#include <ChatAdditions_inc/_SQLite>
#endif
#else // DATABASE_TYPE
#error Please uncomment DATABASE_TYPE and select!
#endif // DATABASE_TYPE
static bool: g_bStorageInitialized;
public plugin_precache() {
register_plugin("[CA] Gag", "1.0.0-beta", "Sergey Shorokhov");
register_dictionary("CA_Gag.txt");
register_dictionary("common.txt");
register_dictionary("time.txt");
register_srvcmd("ca_gag_add_reason", "SrvCmd_AddReason");
register_srvcmd("ca_gag_show_templates", "SrvCmd_ShowTemplates"); // debug
hook_cvar_change(
create_cvar("ca_gag_times", "1, 5, 30, 60, 1440, 10080"),
"Hook_CVar_Times"
);
new sConfigsDir[PLATFORM_MAX_PATH];
get_localinfo("amxx_configsdir", sConfigsDir, charsmax(sConfigsDir));
server_cmd("exec %s/ChatAdditions/gag_reasons.cfg", sConfigsDir);
server_exec();
g_aGagTimes = ArrayCreate();
new const szCmd[] = "gag";
new const szCtrlChar[][] = {"!", "/", "\\", "." , "?", ""};
for(new i; i < sizeof(szCtrlChar); i++) {
register_clcmd(fmt("%s%s", szCtrlChar[i], szCmd), "ClCmd_Gag", FLAGS_ACCESS);
register_clcmd(fmt("say %s%s", szCtrlChar[i], szCmd), "ClCmd_Gag", FLAGS_ACCESS);
register_clcmd(fmt("say_team %s%s", szCtrlChar[i], szCmd), "ClCmd_Gag", FLAGS_ACCESS);
}
register_clcmd("enter_GagReason", "ClCmd_EnterGagReason");
register_clcmd("enter_GagTime", "ClCmd_EnterGagTime");
const Float: UPDATER_FREQ = 3.0;
set_task(UPDATER_FREQ, "Gags_Thinker", .flags = "b");
}
public OnConfigsExecuted() {
new sTimes[128];
get_cvar_string("ca_gag_times", sTimes, charsmax(sTimes));
ParseTimes(sTimes);
}
public plugin_natives() {
register_library("ChatAdditions_GAG_API");
// TODO: Need CRUD
register_native("ca_set_user_gag", "native_ca_set_user_gag");
register_native("ca_get_user_gag", "native_ca_get_user_gag");
register_native("ca_has_user_gag", "native_ca_has_user_gag");
// register_native("ca_update_user_gag", "native_ca_update_user_gag");
register_native("ca_remove_user_gag", "native_ca_remove_user_gag");
// TODO: Create forwards: gagged, ungagged, loaded from storage, saved to storage
}
public Gags_Thinker() {
static aPlayers[MAX_PLAYERS], iCount;
get_players_ex(aPlayers, iCount, .flags = (GetPlayers_ExcludeBots | GetPlayers_ExcludeHLTV));
static iSysTime; iSysTime = get_systime();
for(new i; i < iCount; i++) {
new id = aPlayers[i];
// server_print("GAG TIME LEFT: %n (%i)", id, (g_aCurrentGags[id][_ExpireTime] - iSysTime));
if(g_aCurrentGags[id][_bitFlags] != m_REMOVED && g_aCurrentGags[id][_ExpireTime] < iSysTime)
GagExpired(id);
}
}
public ClCmd_Gag(id, level, cid) {
#if !defined DEBUG
if(!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED;
#endif
if(get_playersnum() < 2) {
client_print_color(id, print_team_default, "%s %L", MSG_PREFIX, id, "NotEnoughPlayers");
return PLUGIN_HANDLED;
}
Menu_Show_PlayersList(id);
return PLUGIN_HANDLED;
}
static Menu_Show_PlayersList(id) {
new hMenu = menu_create(fmt("%L", id, "CA_Gag_TITLE"), "Menu_Handler_PlayersList");
new aPlayers[MAX_PLAYERS], iCount;
get_players(aPlayers, iCount, .flags = "ch");
new hCallback = menu_makecallback("Callback_PlayersMenu");
for(new i; i < iCount; i++) {
if(id != aPlayers[i])
menu_additem(hMenu, "-", fmt("%i", get_user_userid(aPlayers[i])), .callback = hCallback);
}
menu_display(id, hMenu);
}
public Callback_PlayersMenu(id, menu, item) {
new null, sInfo[64], sName[64];
menu_item_getinfo(menu, item, null, sInfo, charsmax(sInfo), sName, charsmax(sName), null);
new target = find_player_ex((FindPlayer_MatchUserId | FindPlayer_ExcludeBots), strtol(sInfo));
new bool:bHaveImmunity = !!(get_user_flags(target) & FLAGS_IMMUNITY);
menu_item_setname(menu, item, fmt("%n %s", target, GetPostfix(id, target, bHaveImmunity)));
return (!bHaveImmunity) ? ITEM_ENABLED : ITEM_DISABLED;
}
public Menu_Handler_PlayersList(id, menu, item) {
if(item == MENU_EXIT || item < 0) {
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new null, sInfo[64], sName[64];
menu_item_getinfo(menu, item, null, sInfo, charsmax(sInfo), sName, charsmax(sName), null);
new target = find_player_ex((FindPlayer_MatchUserId | FindPlayer_ExcludeBots), strtol(sInfo));
if(!is_user_connected(target)) {
menu_destroy(menu);
Menu_Show_PlayersList(id);
client_print_color(id, print_team_red, "%s %L", MSG_PREFIX, id, "Player_NotConnected");
return PLUGIN_HANDLED;
}
if(g_aCurrentGags[target][_bitFlags] != m_REMOVED) {
GagData_Copy(g_aGags_AdminEditor[id], g_aCurrentGags[target]);
g_aGags_AdminEditor[id][_Player] = target;
Menu_Show_ConfirmRemove(id);
}else {
GagData_GetPersonalData(id, target, g_aGags_AdminEditor[id]);
Menu_Show_GagProperties(id);
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
// Confirm remove gag
static Menu_Show_ConfirmRemove(id) {
new hMenu = menu_create(fmt("%L", id, "GAG_Confirm"), "Menu_Handler_ConfirmRemove");
menu_additem(hMenu, fmt("%L", id, "CA_GAG_YES"));
menu_additem(hMenu, fmt("%L", id, "CA_GAG_NO"));
menu_display(id, hMenu);
}
public Menu_Handler_ConfirmRemove(id, menu, item) {
enum { menu_Yes, menu_No };
new target = g_aGags_AdminEditor[id][_Player];
if(!is_user_connected(target)) {
menu_destroy(menu);
client_print_color(id, print_team_red, "%s %L", MSG_PREFIX, id, "Player_NotConnected");
Menu_Show_PlayersList(id);
return PLUGIN_HANDLED;
}
if(item == MENU_EXIT || item < 0) {
menu_destroy(menu);
ResetTargetData(id);
Menu_Show_PlayersList(id);
return PLUGIN_HANDLED;
}
switch(item) {
case menu_Yes: {
RemoveGag(id, target);
}
case menu_No: {
// Copy target to temporary
new aGagData[gag_s]; {
GagData_GetPersonalData(id, target, aGagData);
// Get old gag data
copy(aGagData[_Reason], charsmax(aGagData[_Reason]), g_aCurrentGags[target][_Reason]);
aGagData[_Time] = g_aCurrentGags[target][_Time];
aGagData[_bitFlags] = g_aCurrentGags[target][_bitFlags];
}
GagData_Copy(g_aGags_AdminEditor[id], aGagData);
// DEBUG__Dump_GagData("Menu_Handler_ConfirmRemove", g_aGags_AdminEditor[id]);
Menu_Show_GagProperties(id);
return PLUGIN_HANDLED;
}
}
menu_destroy(menu);
Menu_Show_PlayersList(id);
return PLUGIN_HANDLED;
}
// Gag Properties menu
static Menu_Show_GagProperties(id) {
new target = g_aGags_AdminEditor[id][_Player];
new hMenu = menu_create(fmt("%L", id, "CA_Gag_Properties", target), "Menu_Handler_GagProperties");
new hCallback = menu_makecallback("Callback_GagProperties");
menu_additem(hMenu, "Chat:", .callback = hCallback);
menu_additem(hMenu, "Team chat:", .callback = hCallback);
menu_additem(hMenu, "Voice chat:", .callback = hCallback);
menu_addblank(hMenu, false);
menu_additem(hMenu, "Reason:", .callback = hCallback);
menu_additem(hMenu, "Time:", .callback = hCallback);
menu_addblank(hMenu, false);
menu_additem(hMenu, "Confirm!", .callback = hCallback);
menu_display(id, hMenu);
}
public Callback_GagProperties(id, menu, item) {
enum { menu_Chat, menu_TeamChat, menu_VoiceChat,
menu_Reason, menu_Time, menu_Confirm
};
new gag_flags_s: gagFlags = g_aGags_AdminEditor[id][_bitFlags];
new target = g_aGags_AdminEditor[id][_Player];
new bool: hasAlreadyGag = g_aCurrentGags[target][_bitFlags] != m_REMOVED;
new bool: hasChanges = !GagData_Equal(g_aCurrentGags[target], g_aGags_AdminEditor[id]);
// DEBUG__Dump_GagData("Callback_GagProperties", g_aGags_AdminEditor[id]);
new null, sInfo[64], sName[64];
menu_item_getinfo(menu, item, null, sInfo, charsmax(sInfo), sName, charsmax(sName), null);
switch(item) {
case menu_Chat:
formatex(sName, charsmax(sName), "%L [ %s ]", id, "CA_Gag_Say", (gagFlags & m_Say) ? " \\r+\\w " : "-");
case menu_TeamChat:
formatex(sName, charsmax(sName), "%L [ %s ]", id, "CA_Gag_SayTeam", (gagFlags & m_SayTeam) ? " \\r+\\w " : "-");
case menu_VoiceChat:
formatex(sName, charsmax(sName), "%L [ %s ]", id, "CA_Gag_Voice", (gagFlags & m_Voice) ? " \\r+\\w " : "-");
case menu_Reason:
formatex(sName, charsmax(sName), "%L [ \\y%s\\w ]", id, "CA_Gag_Reason", Get_GagStringReason(id, target));
case menu_Time:
formatex(sName, charsmax(sName), "%L [ \\y%s\\w ]", id, "CA_Gag_Time", GetStringTime_seconds(id, g_aGags_AdminEditor[id][_Time]));
case menu_Confirm: {
formatex(sName, charsmax(sName), "%L %s", id, "CA_Gag_Confirm", (hasAlreadyGag && hasChanges) ? "edit" : "");
}
}
menu_item_setname(menu, item, sName);
return (
item == menu_Confirm && !Ready_To_Gag(id)
|| DATABASE_TYPE == DB_NVault && item == menu_Reason
) ? ITEM_DISABLED : ITEM_ENABLED;
}
public Menu_Handler_GagProperties(id, menu, item) {
enum { menu_Chat, menu_TeamChat, menu_VoiceChat,
menu_Reason, menu_Time, menu_Confirm
};
if(item == MENU_EXIT || item < 0) {
menu_destroy(menu);
ResetTargetData(id);
Menu_Show_PlayersList(id);
return PLUGIN_HANDLED;
}
new target = g_aGags_AdminEditor[id][_Player];
if(!is_user_connected(target)) {
menu_destroy(menu);
Menu_Show_PlayersList(id);
client_print_color(id, print_team_red, "%s %L", MSG_PREFIX, id, "Player_NotConnected");
return PLUGIN_HANDLED;
}
switch(item) {
case menu_Chat: Gag_ToggleFlags(id, m_Say);
case menu_TeamChat: Gag_ToggleFlags(id, m_SayTeam);
case menu_VoiceChat: Gag_ToggleFlags(id, m_Voice);
case menu_Reason: {
menu_destroy(menu);
Menu_Show_SelectReason(id, target);
return PLUGIN_HANDLED;
}
case menu_Time: {
menu_destroy(menu);
Menu_Show_SelectTime(id, target);
return PLUGIN_HANDLED;
}
case menu_Confirm: {
menu_destroy(menu);
SaveGag(id ,target);
return PLUGIN_HANDLED;
}
}
menu_destroy(menu);
Menu_Show_GagProperties(id);
return PLUGIN_HANDLED;
}
stock bool: Ready_To_Gag(id) {
return (g_aGags_AdminEditor[id][_bitFlags] != m_REMOVED ) ? true : false;
}
public Menu_Show_SelectReason(id, target) {
if(!is_user_connected(target)) {
client_print_color(id, print_team_red, "%s %L", MSG_PREFIX, id, "Player_NotConnected");
return PLUGIN_HANDLED;
}
new szTemp[MAX_REASON_LEN];
formatex(szTemp, charsmax(szTemp), "%L", id, "MENU_SelectReason");
new hMenu = menu_create(szTemp, "Menu_Handler_SelectReason");
formatex(szTemp, charsmax(szTemp), "%L", id, "EnterReason");
menu_additem(hMenu, szTemp, "-1");
if(g_iArraySize_Reasons) {
for(new i; i < g_iArraySize_Reasons; i++) {
new aReason[gag_s];
ArrayGetArray(g_aReasons, i, aReason);
menu_additem(hMenu,
fmt("%s (\\y%s\\w)", aReason[_Reason], GetStringTime_seconds(id, aReason[_Time])),
fmt("%i", i));
// server_print("ADDMNU[%i]:%s, szInfo(%s)", i, szItemName, szItemInfo);
}
} else menu_addtext(hMenu, fmt("\\d %L", id, "NoHaveReasonsTemplates"), .slot = false);
return menu_display(id, hMenu);
}
public Menu_Handler_SelectReason(id, menu, item) {
if(item == MENU_EXIT || item < 0) {
menu_destroy(menu);
Menu_Show_GagProperties(id);
return PLUGIN_HANDLED;
}
new target = g_aGags_AdminEditor[id][_Player];
if(!is_user_connected(target)) {
menu_destroy(menu);
client_print_color(id, print_team_red, "%s %L", MSG_PREFIX, id, "Player_NotConnected");
Menu_Show_PlayersList(id);
return PLUGIN_HANDLED;
}
static szItemInfo[3], dummy[1];
menu_item_getinfo(menu, item, dummy[0], szItemInfo, charsmax(szItemInfo), dummy[0], charsmax(dummy), dummy[0]);
new iReason = str_to_num(szItemInfo)/* + 1 */;
if(iReason == -1) {
client_cmd(id, "messagemode enter_GagReason");
return PLUGIN_HANDLED;
}
new aReason[gag_s];
ArrayGetArray(g_aReasons, iReason, aReason);
copy(g_aGags_AdminEditor[id][_Reason], charsmax(g_aGags_AdminEditor[][_Reason]), aReason[_Reason]);
// IF NEED OFC
g_aGags_AdminEditor[id][_Time] = aReason[_Time];
// log_amx("aReason[_Time]=%i, aReason[_Reason]=%s", aReason[_Time], aReason[_Reason]);
menu_destroy(menu);
Menu_Show_GagProperties(id);
return PLUGIN_HANDLED;
}
public Menu_Show_SelectTime(id, target) {
if(!is_user_connected(target)) {
client_print_color(id, print_team_red, "%s %L", MSG_PREFIX, id, "Player_NotConnected");
Menu_Show_PlayersList(id);
return PLUGIN_HANDLED;
}
new hMenu = menu_create(fmt("%L", id, "MENU_SelectTime"), "Menu_Handler_SelectTime");
menu_additem(hMenu, fmt("%L", id, "SET_CustomTime"));
menu_additem(hMenu, fmt("%L", id, "CA_Gag_Perpapent"));
menu_addblank(hMenu, .slot = false);
if(g_iArraySize_GagTimes) {
for(new i; i < g_iArraySize_GagTimes; i++) {
new iTime = ArrayGetCell(g_aGagTimes, i) * SECONDS_IN_MINUTE;
menu_additem(hMenu, GetStringTime_seconds(id, iTime), fmt("%i", iTime));
}
} else menu_addtext(hMenu, fmt("\\d %L", id, "NoHaveTimeTemplates"), .slot = false);
return menu_display(id, hMenu);
}
public Menu_Handler_SelectTime(id, menu, item) {
enum { menu_CustomTime, menu_Permament };
if(item == MENU_EXIT || item < 0) {
menu_destroy(menu);
Menu_Show_GagProperties(id);
return PLUGIN_HANDLED;
}
new target = g_aGags_AdminEditor[id][_Player];
if(!is_user_connected(target)) {
menu_destroy(menu);
client_print_color(id, print_team_red, "%s %L", MSG_PREFIX, id, "Player_NotConnected");
Menu_Show_PlayersList(id);
return PLUGIN_HANDLED;
}
switch(item) {
case menu_CustomTime: {
menu_destroy(menu);
client_cmd(id, "messagemode enter_GagTime");
return PLUGIN_HANDLED;
}
case menu_Permament: {
menu_destroy(menu);
g_aGags_AdminEditor[id][_Time] = FOREVER;
Menu_Show_GagProperties(id);
return PLUGIN_HANDLED;
}
}
static sInfo[64], dummy[1];
menu_item_getinfo(menu, item, dummy[0], sInfo, charsmax(sInfo), dummy[0], charsmax(dummy), dummy[0]);
g_aGags_AdminEditor[id][_Time] = strtol(sInfo);
menu_destroy(menu);
Menu_Show_GagProperties(id);
return PLUGIN_HANDLED;
}
public ClCmd_EnterGagTime(id) {
new target = g_aGags_AdminEditor[id][_Player];
if(!is_user_connected(target)) {
client_print_color(id, print_team_red, "%s %L", MSG_PREFIX, id, "Player_NotConnected");
Menu_Show_PlayersList(id);
return PLUGIN_HANDLED;
}
static sCustomTime[128];
read_argv(1, sCustomTime, charsmax(sCustomTime));
if(!sCustomTime[0]) {
Menu_Show_SelectTime(id, target);
return PLUGIN_HANDLED;
}
g_aGags_AdminEditor[id][_Time] = strtol(sCustomTime);
client_print(id, print_chat, "%L '%s'", id, "CustomTime_Setted", GetStringTime_seconds(id, g_aGags_AdminEditor[id][_Time]));
Menu_Show_GagProperties(id);
return PLUGIN_HANDLED;
}
public ClCmd_EnterGagReason(id) {
new target = g_aGags_AdminEditor[id][_Player];
if(!is_user_connected(target))
return PLUGIN_HANDLED;
static szCustomReason[128];
read_argv(1, szCustomReason, charsmax(szCustomReason));
if(!szCustomReason[0])
{
Menu_Show_SelectReason(id, target);
return PLUGIN_HANDLED;
}
copy(g_aGags_AdminEditor[id][_Reason], charsmax(g_aGags_AdminEditor[][_Reason]), szCustomReason);
client_print(id, print_chat, "%L '%s'", id, "CustomReason_Setted", g_aGags_AdminEditor[id][_Reason]);
Menu_Show_GagProperties(id);
return PLUGIN_HANDLED;
}
Gag_ToggleFlags(id, gag_flags_s: flag) {
g_aGags_AdminEditor[id][_bitFlags] ^= flag;
}
stock GetStringTime_seconds(const id, const iSeconds) {
new sTime[32];
get_time_length(id, iSeconds, timeunit_seconds, sTime, charsmax(sTime));
if(iSeconds == FOREVER)
formatex(sTime, charsmax(sTime), "%L", id, "CA_Gag_Perpapent");
if(sTime[0] == EOS)
formatex(sTime, charsmax(sTime), "%L", id, "CA_Gag_NotSet");
return sTime;
}
Get_GagStringReason(const id, const target) {
static sText[MAX_REASON_LEN], len = charsmax(sText);
if(id != LANG_PLAYER)
copy(sText, len, g_aGags_AdminEditor[id][_Reason]);
else copy(sText, len, g_aCurrentGags[target][_Reason]);
if(sText[0] == EOS)
formatex(sText, len, "%L", id, "CA_Gag_NotSet");
return sText;
}
public SrvCmd_AddReason() {
if(!g_aReasons) g_aReasons = ArrayCreate(gag_s);
enum any: args_s { arg0, arg1, arg2, arg3 };
new szArgs[args_s][32];
for(new iArg = arg0; iArg < sizeof szArgs; iArg++)
read_argv(iArg, szArgs[iArg], charsmax(szArgs[]));
new iArgsCount = read_argc();
if(iArgsCount < 2){
log_amx("\tUsage: ca_gag_add_reason <reason> [flags] [time in minutes]");
return;
}
new aReason[gag_s];
copy(aReason[_Reason], charsmax(aReason[_Reason]), szArgs[arg1]);
aReason[_bitFlags] = gag_flags_s: flags_to_bit(szArgs[arg2]);
aReason[_Time] = str_to_num(szArgs[arg3]) * SECONDS_IN_MINUTE;
// num_to_str(str_to_num(szArgs[arg3]) * SECONDS_IN_MINUTE, aReason[_Time], charsmax(aReason[_Time]));
ArrayPushArray(g_aReasons, aReason);
g_iArraySize_Reasons = ArraySize(g_aReasons);
log_amx("ADD: Reason[#%i]: '%s' (Flags:'%s', Time:'%i s.')",
g_iArraySize_Reasons, aReason[_Reason], bits_to_flags(aReason[_bitFlags]), aReason[_Time]
);
}
public SrvCmd_ShowTemplates() {
if(/* !g_iArraySize_GagTimes || */ !g_iArraySize_Reasons) {
log_amx("\t[WARN] NO REASONS FOUNDED!");
return PLUGIN_HANDLED;
} else {
for(new i; i < g_iArraySize_Reasons; i++) {
new aReason[gag_s];
ArrayGetArray(g_aReasons, i, aReason);
server_print("Reason[#%i]: '%s' (Flags:'%s', Time:'%i')",
i, aReason[_Reason], bits_to_flags(aReason[_bitFlags]), aReason[_Time]
);
}
}
return PLUGIN_HANDLED;
}
public Hook_CVar_Times(pcvar, const old_value[], const new_value[]) {
if(!strlen(new_value)) {
log_amx("[WARN] not found times! ca_gag_add_time ='%s'", new_value);
return;
}
ParseTimes(new_value);
}
static ParseTimes(const sTimes[]) {
ArrayClear(g_aGagTimes);
new ePos, stPos, rawPoint[32];
do {
ePos = strfind(sTimes[stPos],",");
formatex(rawPoint, ePos, sTimes[stPos]);
stPos += ePos + 1;
trim(rawPoint);
if(rawPoint[0]) {
ArrayPushCell(g_aGagTimes, strtol(rawPoint));
// server_print("Time added: Time:'%i'", strtol(rawPoint));
}
} while(ePos != -1);
g_iArraySize_GagTimes = ArraySize(g_aGagTimes);
}
static SaveGag(const id, const target) {
GagData_Copy(g_aCurrentGags[target], g_aGags_AdminEditor[id]);
if(id == 0) {
client_print_color(0, print_team_default, "%s %L", MSG_PREFIX,
LANG_PLAYER, "Player_Gagged_ByServer", target, GetStringTime_seconds(LANG_PLAYER, g_aCurrentGags[target][_Time]));
} else {
client_print_color(0, print_team_default, "%s %L", MSG_PREFIX,
LANG_PLAYER, "Player_Gagged", id, target, GetStringTime_seconds(LANG_PLAYER, g_aCurrentGags[target][_Time]));
}
if(g_aCurrentGags[target][_Reason][0])
client_print_color(0, print_team_default, "\4%L '\3%s\1'", LANG_PLAYER, "CA_Gag_Reason", Get_GagStringReason(LANG_PLAYER, target));
if(g_aCurrentGags[target][_Time] == FOREVER)
g_aCurrentGags[target][_ExpireTime] = FOREVER;
else g_aCurrentGags[target][_ExpireTime] = get_systime() + g_aCurrentGags[target][_Time];
GagData_Reset(g_aGags_AdminEditor[id]);
client_cmd(target, "-voicerecord");
save_to_storage(g_aCurrentGags[target]);
return PLUGIN_CONTINUE;
}
static RemoveGag(const id, const target) {
if(g_aGags_AdminEditor[id][_bitFlags] != m_REMOVED) {
ResetTargetData(id);
remove_from_storage(g_aCurrentGags[id]);
GagData_Reset(g_aCurrentGags[target]);
client_print_color(0, print_team_default, "%L",
LANG_PLAYER, "Player_UnGagged", id, target);
} else {
client_print(id, print_chat, "%s %L", MSG_PREFIX, id, "Player_AlreadyRemovedGag", target);
}
Menu_Show_PlayersList(id);
return PLUGIN_HANDLED;
}
static GagExpired(const id) {
g_aCurrentGags[id][_bitFlags] = m_REMOVED;
remove_from_storage(g_aCurrentGags[id]);
client_print_color(0, print_team_default, "%s %L",MSG_PREFIX, LANG_PLAYER, "Player_ExpiredGag", id);
}
static LoadGag(const target) {
new aGagData[gag_s]; {
GagData_GetPersonalData(0, target, aGagData);
}
load_from_storage(aGagData);
}
stock ResetTargetData(const id) {
GagData_Reset(g_aGags_AdminEditor[id]);
}
// TODO!
GetPostfix(const id, const target, const bHaveImmunity) {
static szPostfix[32];
if(bHaveImmunity)
formatex(szPostfix, charsmax(szPostfix), " [\\r%L]", id, "Immunity");
else if(g_aCurrentGags[target][_bitFlags])
formatex(szPostfix, charsmax(szPostfix), " [\\y%L\\w]", id, "Gag");
else szPostfix[0] = '\0';
return szPostfix;
}
public client_putinserver(id) {
if(!g_bStorageInitialized)
return;
LoadGag(id);
}
public client_disconnected(id) {
GagData_Reset(g_aCurrentGags[id]);
}
/** <- On Players Events */
public CA_Client_Voice(const listener, const sender) {
return (g_aCurrentGags[sender][_bitFlags] & m_Voice) ? CA_SUPERCEDE : CA_CONTINUE;
}
public CA_Client_SayTeam(id) {
return (g_aCurrentGags[id][_bitFlags] & m_SayTeam) ? CA_SUPERCEDE : CA_CONTINUE;
}
public CA_Client_Say(id) {
return (g_aCurrentGags[id][_bitFlags] & m_Say) ? CA_SUPERCEDE : CA_CONTINUE;
}
/** API -> */
public native_ca_set_user_gag(pPlugin, iParams) {
enum { Player = 1, Reason, Time, Flags };
CHECK_NATIVE_ARGS_NUM(iParams, 4, 0)
new target = get_param(Player);
CHECK_NATIVE_PLAYER(target, 0)
static sReason[MAX_REASON_LEN]; get_array(Reason, sReason, sizeof sReason);
new iTime = get_param(Time) * SECONDS_IN_MINUTE;
new gag_flags_s: iFlags = gag_flags_s: get_param(Flags);
GagData_GetPersonalData(0, target, g_aGags_AdminEditor[0]);
g_aGags_AdminEditor[0][_Player] = 0;
formatex(g_aGags_AdminEditor[0][_AdminName], charsmax(g_aGags_AdminEditor[][_AdminName]), "SERVER");
copy(g_aGags_AdminEditor[0][_Reason], charsmax(g_aGags_AdminEditor[][_Reason]), sReason);
g_aGags_AdminEditor[0][_Time] = iTime;
g_aGags_AdminEditor[0][_bitFlags] = iFlags;
SaveGag(0, target);
return 0;
}
public native_ca_get_user_gag(pPlugin, iParams) {
enum { Player = 1, Reason, Time, Flags };
CHECK_NATIVE_ARGS_NUM(iParams, 4, false)
new id = get_param(Player);
CHECK_NATIVE_PLAYER(id, false)
set_array(Reason, g_aCurrentGags[id][_Reason], charsmax(g_aCurrentGags[][_Reason]));
set_param_byref(Time, g_aCurrentGags[id][_Time]);
set_param_byref(Flags, g_aCurrentGags[id][_bitFlags]);
return (g_aCurrentGags[id][_bitFlags] != m_REMOVED);
}
public native_ca_has_user_gag(pPlugin, iParams) {
enum { Player = 1 };
CHECK_NATIVE_ARGS_NUM(iParams, 1, 0)
new id = get_param(Player);
CHECK_NATIVE_PLAYER(id, 0)
return (g_aCurrentGags[id][_bitFlags] != m_REMOVED);
}
public native_ca_remove_user_gag(pPlugin, iParams) {
/*
enum { Player = 1 };
CHECK_NATIVE_ARGS_NUM(iParams, 1, false)
new id = get_param(Player);
CHECK_NATIVE_PLAYER(id, false)
*/
}
public DB_Types: native_ca_get_storage_type(pPlugin, iParams) {
return DB_Types:DATABASE_TYPE;
}
/** <- API */
// Storage
Storage_Inited(Float: fTime) {
g_bStorageInitialized = true;
server_print("[%s] Storage initialized! (%.4f sec)", DB_Names[DATABASE_TYPE], fTime);
}
Storage_PlayerSaved(const iUserID) {
new target = find_player_ex((FindPlayer_MatchUserId | FindPlayer_ExcludeBots), iUserID);
server_print("[%s] Target [%s] SAVED!", DB_Names[DATABASE_TYPE],
is_user_connected(target) ?
fmt("%n (UsedID:%i)", target, iUserID) :
fmt("UsedID:%i", iUserID)
);
}
Storage_PlayerLoaded(const iUserID, bool: bFound = false) {
new target = find_player_ex((FindPlayer_MatchUserId | FindPlayer_ExcludeBots), iUserID);
GagData_GetPersonalData(0, target, g_aCurrentGags[target]);
if(!bFound)
return;
#if defined DEBUG
server_print("[%s] Target [%s] Loaded! (gag found)", DB_Names[DATABASE_TYPE],
is_user_connected(target) ?
fmt("%n (UsedID:%i)", target, iUserID) :
fmt("UsedID:%i", iUserID)
);
#endif
}
Storage_PlayerRemoved(const iUserID) {
#if defined DEBUG
new target = find_player_ex((FindPlayer_MatchUserId | FindPlayer_ExcludeBots), iUserID);
server_print("[%s] Target [%s] removed!", DB_Names[DATABASE_TYPE],
is_user_connected(target) ?
fmt("%n (UsedID:%i)", target, iUserID) :
fmt("UsedID:%i", iUserID)
);
#endif
}
Вечер добрый, замучила проблема с гагом, когда выдаешь гаг игроку, он перезаходит и гаг слетает, запись гага идет в базу, как сделать чтобы гаг не слетал?
В этой теме было размещено решение! Перейти к решению.