From 31c50fcadf23a133ebe582e104c602272a67ad4d Mon Sep 17 00:00:00 2001 From: Injector Date: Thu, 5 Oct 2023 14:49:44 +0300 Subject: [PATCH 1/2] New plugins ma_novoice --- .github/workflows/build-and-upload.yml | 1 + addons/sourcemod/scripting/ma_novoice.sp | 42 ++++++++++++++++++++++++ ci_sm11.sp | 4 +++ 3 files changed, 47 insertions(+) create mode 100644 addons/sourcemod/scripting/ma_novoice.sp diff --git a/.github/workflows/build-and-upload.yml b/.github/workflows/build-and-upload.yml index 5a4b562..bbb142c 100644 --- a/.github/workflows/build-and-upload.yml +++ b/.github/workflows/build-and-upload.yml @@ -42,6 +42,7 @@ jobs: spcomp __GITHUB=1 _MATERIALADMIN_BASECOMMS=1 materialadmin.git.sp -E -o ../plugins/ma_basecomm -iinclude ${{ matrix.compiler-options }} spcomp __GITHUB=1 _MATERIALADMIN_BASEVOTES=1 materialadmin.git.sp -E -o ../plugins/ma_basevotes -iinclude ${{ matrix.compiler-options }} spcomp __GITHUB=1 _MATERIALADMIN_CHECKER=1 materialadmin.git.sp -E -o ../plugins/ma_checker -iinclude ${{ matrix.compiler-options }} + spcomp __GITHUB=1 _MATERIALADMIN_NOVOICE=1 materialadmin.git.sp -E -o ../plugins/ma_novoice -iinclude ${{ matrix.compiler-options }} - name: Cleanup if: github.ref == 'refs/heads/master' diff --git a/addons/sourcemod/scripting/ma_novoice.sp b/addons/sourcemod/scripting/ma_novoice.sp new file mode 100644 index 0000000..f836c18 --- /dev/null +++ b/addons/sourcemod/scripting/ma_novoice.sp @@ -0,0 +1,42 @@ +#include +#include + +#define SHOW_AMOUNT 3.0 + +bool g_bShowText[MAXPLAYERS + 1]; + +public Plugin myinfo = +{ + name = "Material Admin No Voice", + author = "Bloomstorm", + description = "Check if client has mute and display it to him.", + version = MAVERSION, + url = "https://github.com/CrazyHackGUT/SB_Material_Design/" +}; + +public OnClientPutInServer(int client) +{ + g_bShowText[client] = false; +} + +public void OnClientSpeaking(int client) +{ + if (!g_bShowText[client] && (MAGetClientMuteType(client) == 1 || MAGetClientMuteType(client) == 3)) + { + g_bShowText[client] = true; + CreateTimer(SHOW_AMOUNT, Timer_ShowText, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE); + + SetHudTextParams(-1.0, -1.0, SHOW_AMOUNT, 0, 255, 127, 255, 1); + + ShowHudText(client, -1, "У вас выключен голосовой чат!"); + } +} + +public Action Timer_ShowText(Handle timer, int userid) +{ + int client = GetClientOfUserId(userid); + if (client <= 0) + return Plugin_Stop; + g_bShowText[client] = false; + return Plugin_Stop; +} \ No newline at end of file diff --git a/ci_sm11.sp b/ci_sm11.sp index 9f14c0f..ada0113 100644 --- a/ci_sm11.sp +++ b/ci_sm11.sp @@ -21,3 +21,7 @@ #if defined _MATERIALADMIN_CHECKER #include "ma_checker.sp" #endif + +#if defined _MATERIALADMIN_NOVOICE + #include "ma_novoice.sp" +#endif \ No newline at end of file From 40e92e68b9c52a31b4b1ac3671d5f313ec5d81d6 Mon Sep 17 00:00:00 2001 From: Injector Date: Thu, 5 Oct 2023 14:58:51 +0300 Subject: [PATCH 2/2] New plugin ma_novoice --- addons/sourcemod/scripting/ma_novoice.sp | 8 +++++++- addons/sourcemod/translations/manovoice.phrases.txt | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 addons/sourcemod/translations/manovoice.phrases.txt diff --git a/addons/sourcemod/scripting/ma_novoice.sp b/addons/sourcemod/scripting/ma_novoice.sp index f836c18..5be58e3 100644 --- a/addons/sourcemod/scripting/ma_novoice.sp +++ b/addons/sourcemod/scripting/ma_novoice.sp @@ -14,6 +14,12 @@ public Plugin myinfo = url = "https://github.com/CrazyHackGUT/SB_Material_Design/" }; +public void OnPluginStart() +{ + LoadTranslations("common.phrases"); + LoadTranslations("manovoice.phrases"); +} + public OnClientPutInServer(int client) { g_bShowText[client] = false; @@ -28,7 +34,7 @@ public void OnClientSpeaking(int client) SetHudTextParams(-1.0, -1.0, SHOW_AMOUNT, 0, 255, 127, 255, 1); - ShowHudText(client, -1, "У вас выключен голосовой чат!"); + ShowHudText(client, -1, "%T", "No voice"); } } diff --git a/addons/sourcemod/translations/manovoice.phrases.txt b/addons/sourcemod/translations/manovoice.phrases.txt new file mode 100644 index 0000000..50d8e29 --- /dev/null +++ b/addons/sourcemod/translations/manovoice.phrases.txt @@ -0,0 +1,8 @@ +"Phrases" +{ + "No voice" + { + "en" "Your voice chat is turned off!" + "ru" "У вас выключен голосовой чат!" + } +} \ No newline at end of file