Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New plugin ma_novoice #164

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build-and-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
48 changes: 48 additions & 0 deletions addons/sourcemod/scripting/ma_novoice.sp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include <sdktools_voice>
#include <materialadmin>

#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;
}
8 changes: 8 additions & 0 deletions addons/sourcemod/translations/manovoice.phrases.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"Phrases"
{
"No voice"
{
"en" "Your voice chat is turned off!"
"ru" "У вас выключен голосовой чат!"
}
}
4 changes: 4 additions & 0 deletions ci_sm11.sp
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@
#if defined _MATERIALADMIN_CHECKER
#include "ma_checker.sp"
#endif

#if defined _MATERIALADMIN_NOVOICE
#include "ma_novoice.sp"
#endif