diff --git a/game/addons/sourcemod/scripting/sbpp_comms.sp b/game/addons/sourcemod/scripting/sbpp_comms.sp index a9a05da9e..b95228c4e 100644 --- a/game/addons/sourcemod/scripting/sbpp_comms.sp +++ b/game/addons/sourcemod/scripting/sbpp_comms.sp @@ -133,6 +133,13 @@ enum PeskyPanels int g_iPeskyPanels[MAXPLAYERS + 1][PeskyPanels]; bool g_bPlayerStatus[MAXPLAYERS + 1]; // Player block check status + +// Own Reason Section +bool g_bOwnReason[MAXPLAYERS + 1] = { false, ... }; +int g_iTarget[MAXPLAYERS + 1] = { -1, ... }; +int g_iLength[MAXPLAYERS + 1]; +int g_iType[MAXPLAYERS + 1]; + char g_sName[MAXPLAYERS + 1][MAX_NAME_LENGTH]; bType g_MuteType[MAXPLAYERS + 1]; @@ -192,12 +199,17 @@ public void OnPluginStart() g_hServersWhiteList = new ArrayList(); CreateConVar("sourcecomms_version", PLUGIN_VERSION, _, FCVAR_SPONLY | FCVAR_REPLICATED | FCVAR_NOTIFY); + AddCommandListener(CommandCallback, "sm_gag"); AddCommandListener(CommandCallback, "sm_mute"); AddCommandListener(CommandCallback, "sm_silence"); AddCommandListener(CommandCallback, "sm_ungag"); AddCommandListener(CommandCallback, "sm_unmute"); AddCommandListener(CommandCallback, "sm_unsilence"); + + AddCommandListener(ReasonHook, "say"); + AddCommandListener(ReasonHook, "say_team"); + RegServerCmd("sc_fw_block", FWBlock, "Blocking player comms by command from sourceban web site"); RegServerCmd("sc_fw_ungag", FWUngag, "Ungagging player by command from sourceban web site"); RegServerCmd("sc_fw_unmute", FWUnmute, "Unmuting player by command from sourceban web site"); @@ -262,6 +274,8 @@ public void OnClientDisconnect(int client) CloseMuteExpireTimer(client); CloseGagExpireTimer(client); + + g_bOwnReason[client] = false; } public bool OnClientConnect(int client, char[] rejectmsg, int maxlen) @@ -680,7 +694,10 @@ public int Handle_MenuList(TopMenu menu, TopMenuAction action, TopMenuObject obj void AdminMenu_Target(int client, int type) { + g_bOwnReason[client] = false; + char Title[192], Option[32]; + switch (type) { case TYPE_GAG: @@ -914,6 +931,7 @@ public int MenuHandler_MenuReason(Menu menu, MenuAction action, int param1, int int reasonIndex = StringToInt(sTemp[2]); int lengthIndex = StringToInt(sTemp[3]); int length; + if (lengthIndex >= 0 && lengthIndex <= iNumTimes) length = g_iTimeMinutes[lengthIndex]; else @@ -922,12 +940,49 @@ public int MenuHandler_MenuReason(Menu menu, MenuAction action, int param1, int LogError("Wrong length index in menu - using default time"); } + if (StrEqual(g_sReasonKey[reasonIndex], "Other")) + { + g_bOwnReason[param1] = true; + g_iTarget[param1] = target; + g_iLength[param1] = length; + g_iType[param1] = type; + + PrintToChat(param1, "%s%t", PREFIX, "Chat Reason"); + + return; + } + CreateBlock(param1, target, length, type, g_sReasonKey[reasonIndex]); } } } } +public Action ReasonHook(int iClient, const char[] sCommand, int iArgC) +{ + if (g_bOwnReason[iClient]) + { + g_bOwnReason[iClient] = false; + + char sReason[512]; + + GetCmdArgString(sReason, sizeof sReason); + + if (StrEqual(sReason, "!noreason")) + { + PrintToChat(iClient, "%s%t", PREFIX, "Chat Reason Aborted"); + + return Plugin_Handled; + } + + CreateBlock(iClient, g_iTarget[iClient], g_iLength[iClient], g_iType[iClient], sReason); + + return Plugin_Handled; + } + + return Plugin_Continue; +} + void AdminMenu_List(int client, int index) { char sTitle[192], sOption[32]; diff --git a/game/addons/sourcemod/scripting/sbpp_main.sp b/game/addons/sourcemod/scripting/sbpp_main.sp index 63ea88e35..85aa82ba7 100644 --- a/game/addons/sourcemod/scripting/sbpp_main.sp +++ b/game/addons/sourcemod/scripting/sbpp_main.sp @@ -103,7 +103,8 @@ bool , requireSiteLogin = false /* Require a lastvisited from SB site */ , backupConfig = true , enableAdmins = true - , PlayerStatus[MAXPLAYERS + 1]; /* Player ban check status */ + , PlayerStatus[MAXPLAYERS + 1] /* Player ban check status */ + , g_ownReasons[MAXPLAYERS + 1] = { false, ... }; /* Own Chat Reason */ int g_BanTarget[MAXPLAYERS + 1] = { -1, ... } @@ -111,7 +112,6 @@ int , curLoading , serverID = -1 , ProcessQueueTime = 5 - , g_ownReasons[MAXPLAYERS + 1] = { false, ... } /* Own Chat Reason */ , CommandDisable; /* Disable of addban and unban */ @@ -383,7 +383,7 @@ public Action ChatHook(int client, int args) g_ownReasons[client] = false; - if (StrEqual(reason[0], "!noreason")) + if (StrEqual(reason, "!noreason")) { PrintToChat(client, "%c[%cSourceBans%c]%c %t", GREEN, NAMECOLOR, GREEN, NAMECOLOR, "Chat Reason Aborted"); return Plugin_Handled; diff --git a/game/addons/sourcemod/translations/sbpp_comms.phrases.txt b/game/addons/sourcemod/translations/sbpp_comms.phrases.txt index cb16da383..ad190dfe3 100644 --- a/game/addons/sourcemod/translations/sbpp_comms.phrases.txt +++ b/game/addons/sourcemod/translations/sbpp_comms.phrases.txt @@ -1336,4 +1336,35 @@ "chi" "你不能指定惩罚时长." "tr" "Belirtilen yasaklama süresi için yetkiniz bulunmamaktadır." } + //--------------------------------------------------------------------------------- + "Chat Reason" + { + "en" "Please type the reason for ban in chat and press enter. Type '!noreason' to abort." + "nl" "Typ alstublieft de reden voor de ban in chat and druk op enter. Typ '!noreason' om the annuleren." + "fr" "Merci d'écrire la raison du ban dans le chat. Tapez '!noreason' pour annuler." + "pl" "Proszę wpisać powód bana w czacie oraz potwierdzić przyciskiem Enter. Wpisz !noreason by anulować." + "pt" "Por favor, digite no chat o motivo para o banimento e pressione enter. Digite '!noreason' para cancelar." + "de" "Bitte schreiben Sie den Grund für den Ban in den Chat. Schreiben Sie '!noreason' um abzubrechen." + "ru" "Введите причину бана и нажмите Ввод. Введите '!noreason' для отмены бана." + "da" "Skriv venligst din grund for udelukkelsen ind i chatten og tryk enter. Skriv '!noreason' for at annullere." + "no" "Vennligst skriv din grunn for utestengelse i chaten og trykk enter. Skriv 'noreason' for og annulere." + "hu" "Írd be a chatre az indokot, majd nyomj entert. Írd '!noreason' a megszakításhoz." + "chi" "请在聊天框中填写封禁理由并提交或输入 '!noreason' 放弃操作." + "tr" "Lütfen bir sebep belirtiniz. İptal etmek için '!noreason' yazınız." + } + "Chat Reason Aborted" + { + "en" "The ban procedure has been stopped successfully." + "nl" "De ban procedure is succesvol gestopt." + "fr" "La procédure de ban a été arrêté avec succès." + "pl" "Procedura banowania została pomyślnie zatrzymana." + "pt" "O procedimento de banimento foi interrompido com sucesso." + "de" "Der Banvorgang wurde erfolgreich angehalten." + "ru" "Бан отменён." + "da" "Udelukkelses proceduren blev stoppet med success" + "no" "Utestengelses prossedyren ble stoppet vellykket." + "hu" "A ban eljárás sikeresen leállítva." + "chi" "封禁操作已成功取消." + "tr" "Yasaklama işlemi iptal edildi." + } }