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..5be58e3 --- /dev/null +++ b/addons/sourcemod/scripting/ma_novoice.sp @@ -0,0 +1,48 @@ +#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 void OnPluginStart() +{ + LoadTranslations("common.phrases"); + LoadTranslations("manovoice.phrases"); +} + +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, "%T", "No voice"); + } +} + +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/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 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