diff --git a/SMJSONAPI/scripting/Subscribe.inc b/SMJSONAPI/scripting/Subscribe.inc index 0ee6b4f3..ab5e9976 100644 --- a/SMJSONAPI/scripting/Subscribe.inc +++ b/SMJSONAPI/scripting/Subscribe.inc @@ -203,8 +203,6 @@ static int Subscribe_GameEvents_Replay(int Index, const char[] sEventName) JSONObject jEventData = new JSONObject(); jEventData.SetString("name", sName); - char sBuf[MAX_NAME_LENGTH]; - jEventData.GetString("name", sBuf, sizeof(sBuf)); jEventData.SetInt("index", client - 1); jEventData.SetInt("userid", GetClientUserId(client)); jEventData.SetString("networkid", sSteamID); diff --git a/SelfMute/scripting/SelfMute.sp b/SelfMute/scripting/SelfMute.sp index 1746c112..0a5f46d7 100644 --- a/SelfMute/scripting/SelfMute.sp +++ b/SelfMute/scripting/SelfMute.sp @@ -12,15 +12,20 @@ #include #define REQUIRE_PLUGIN +#undef REQUIRE_EXTENSIONS +#tryinclude +#define REQUIRE_EXTENSIONS + #pragma newdecls required bool g_Plugin_ccc = false; bool g_Plugin_zombiereloaded = false; bool g_Plugin_voiceannounce_ex = false; bool g_Plugin_AdvancedTargeting = false; +bool g_Extension_Voice = false; bool g_bIsProtoBuf = false; -#define PLUGIN_VERSION "2.2" +#define PLUGIN_VERSION "2.3" public Plugin myinfo = { @@ -86,12 +91,15 @@ public void OnAllPluginsLoaded() g_Plugin_zombiereloaded = LibraryExists("zombiereloaded"); g_Plugin_voiceannounce_ex = LibraryExists("voiceannounce_ex"); g_Plugin_AdvancedTargeting = LibraryExists("AdvancedTargeting"); - LogMessage("SelfMute capabilities:\nProtoBuf: %s\nCCC: %s\nZombieReloaded: %s\nVoiceAnnounce: %s\nAdvancedTargeting: %s", + g_Extension_Voice = LibraryExists("Voice"); + + LogMessage("SelfMute capabilities:\nProtoBuf: %s\nCCC: %s\nZombieReloaded: %s\nVoiceAnnounce: %s\nAdvancedTargeting: %s\nVoice: %s", (g_bIsProtoBuf ? "yes" : "no"), (g_Plugin_ccc ? "loaded" : "not loaded"), (g_Plugin_zombiereloaded ? "loaded" : "not loaded"), (g_Plugin_voiceannounce_ex ? "loaded" : "not loaded"), - (g_Plugin_AdvancedTargeting ? "loaded" : "not loaded")); + (g_Plugin_AdvancedTargeting ? "loaded" : "not loaded"), + (g_Extension_Voice ? "loaded" : "not loaded")); } public void OnClientPutInServer(int client) @@ -632,6 +640,21 @@ public Action Command_CheckMutes(int client, int args) return Plugin_Handled; } +stock bool _IsClientSpeaking(int client) +{ + #if defined _voiceannounceex_included_ + if(g_Plugin_voiceannounce_ex) + return IsClientSpeaking(client); + #endif + + #if defined _voice_included + if(g_Extension_Voice) + return IsClientTalking(client); + #endif + + return false; +} + /* * MENU */ @@ -642,14 +665,12 @@ void DisplayMuteMenu(int client) int[] aClients = new int[MaxClients + 1]; - #if defined _voiceannounceex_included_ - if(g_Plugin_voiceannounce_ex) { // Count talking players and insert id's into aClients array int CurrentlyTalking = 0; for(int i = 1; i <= MaxClients; i++) { - if(i != client && IsClientInGame(i) && !IsFakeClient(i) && IsClientSpeaking(i)) + if(i != client && IsClientInGame(i) && !IsFakeClient(i) && _IsClientSpeaking(i)) aClients[CurrentlyTalking++] = i; } @@ -676,7 +697,6 @@ void DisplayMuteMenu(int client) menu.AddItem("", "", ITEMDRAW_RAWLINE); } } - #endif menu.AddItem("@all", "Everyone"); menu.AddItem("@spec", "Spectators"); diff --git a/includes/voice.inc b/includes/voice.inc new file mode 100644 index 00000000..c536af40 --- /dev/null +++ b/includes/voice.inc @@ -0,0 +1,32 @@ +#if defined _voice_included + #endinput +#endif +#define _voice_included + +native bool IsClientTalking(int client); + +/** + * Do not edit below this line! + */ +public Extension __ext_voice = +{ + name = "Voice", + file = "Voice.ext", +#if defined AUTOLOAD_EXTENSIONS + autoload = 1, +#else + autoload = 0, +#endif +#if defined REQUIRE_EXTENSIONS + required = 1, +#else + required = 0, +#endif +}; + +#if !defined REQUIRE_EXTENSIONS +public __ext_voice_SetNTVOptional() +{ + MarkNativeAsOptional("IsClientTalking"); +} +#endif