From 5ba8cae70a778a4b8506286df6f73c65c77d01d1 Mon Sep 17 00:00:00 2001 From: BotoX Date: Thu, 19 May 2016 16:12:34 +0200 Subject: [PATCH] added cs: go support to SelfMute, WeaponCleaner and voiceannounce_ex fixed sourcebans version by request fixed awful bug in spectate plugin --- .../scripting/PlayerVisibility.sp | 2 + SelfMute/scripting/SelfMute.sp | 73 ++++++++++++++----- Spectate/scripting/Spectate.sp | 4 +- WeaponCleaner/scripting/WeaponCleaner.sp | 2 + sourcebans/scripting/sbchecker.sp | 2 +- sourcebans/scripting/sourcebans.sp | 4 +- sourcebans/scripting/sourcecomms.sp | 2 +- .../gamedata/voiceannounce_ex.games.txt | 62 +++++++++++----- 8 files changed, 110 insertions(+), 41 deletions(-) diff --git a/PlayerVisibility/scripting/PlayerVisibility.sp b/PlayerVisibility/scripting/PlayerVisibility.sp index 7c11efc6..f5664fba 100644 --- a/PlayerVisibility/scripting/PlayerVisibility.sp +++ b/PlayerVisibility/scripting/PlayerVisibility.sp @@ -4,6 +4,8 @@ #include #include +#pragma newdecls required + public Plugin myinfo = { name = "PlayerVisibility", diff --git a/SelfMute/scripting/SelfMute.sp b/SelfMute/scripting/SelfMute.sp index 92e8d08c..bd8d0e91 100644 --- a/SelfMute/scripting/SelfMute.sp +++ b/SelfMute/scripting/SelfMute.sp @@ -18,8 +18,9 @@ bool g_Plugin_ccc = false; bool g_Plugin_zombiereloaded = false; bool g_Plugin_voiceannounce_ex = false; bool g_Plugin_AdvancedTargeting = false; +bool g_bIsProtoBuf = false; -#define PLUGIN_VERSION "2.1" +#define PLUGIN_VERSION "2.2" public Plugin myinfo = { @@ -62,6 +63,9 @@ public void OnPluginStart() HookEvent("round_end", Event_Round); HookEvent("player_team", Event_TeamChange); + if(GetFeatureStatus(FeatureType_Native, "GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf) + g_bIsProtoBuf = true; + UserMsg RadioText = GetUserMessageId("RadioText"); if(RadioText == INVALID_MESSAGE_ID) SetFailState("This game doesn't support RadioText user messages."); @@ -81,7 +85,8 @@ public void OnAllPluginsLoaded() g_Plugin_zombiereloaded = LibraryExists("zombiereloaded"); g_Plugin_voiceannounce_ex = LibraryExists("voiceannounce_ex"); g_Plugin_AdvancedTargeting = LibraryExists("AdvancedTargeting"); - LogMessage("CCC: %s\nZombieReloaded: %s\nVoiceAnnounce: %s\nAdvancedTargeting: %s", + LogMessage("SelfMute capabilities:\nProtoBuf: %s\nCCC: %s\nZombieReloaded: %s\nVoiceAnnounce: %s\nAdvancedTargeting: %s", + (g_bIsProtoBuf ? "yes" : "no"), (g_Plugin_ccc ? "loaded" : "not loaded"), (g_Plugin_zombiereloaded ? "loaded" : "not loaded"), (g_Plugin_voiceannounce_ex ? "loaded" : "not loaded"), @@ -818,13 +823,26 @@ int g_MsgPlayers[MAXPLAYERS + 1]; public Action Hook_UserMessageRadioText(UserMsg msg_id, Handle bf, const int[] players, int playersNum, bool reliable, bool init) { - g_MsgDest = BfReadByte(bf); - g_MsgClient = BfReadByte(bf); - BfReadString(bf, g_MsgName, sizeof(g_MsgName), false); - BfReadString(bf, g_MsgParam1, sizeof(g_MsgParam1), false); - BfReadString(bf, g_MsgParam2, sizeof(g_MsgParam2), false); - BfReadString(bf, g_MsgParam3, sizeof(g_MsgParam3), false); - BfReadString(bf, g_MsgParam4, sizeof(g_MsgParam4), false); + if(g_bIsProtoBuf) + { + g_MsgDest = PbReadInt(bf, "msg_dst"); + g_MsgClient = PbReadInt(bf, "client"); + PbReadString(bf, "msg_name", g_MsgName, sizeof(g_MsgName)); + PbReadString(bf, "params", g_MsgParam1, sizeof(g_MsgParam1), 0); + PbReadString(bf, "params", g_MsgParam2, sizeof(g_MsgParam2), 1); + PbReadString(bf, "params", g_MsgParam3, sizeof(g_MsgParam3), 2); + PbReadString(bf, "params", g_MsgParam4, sizeof(g_MsgParam4), 3); + } + else + { + g_MsgDest = BfReadByte(bf); + g_MsgClient = BfReadByte(bf); + BfReadString(bf, g_MsgName, sizeof(g_MsgName), false); + BfReadString(bf, g_MsgParam1, sizeof(g_MsgParam1), false); + BfReadString(bf, g_MsgParam2, sizeof(g_MsgParam2), false); + BfReadString(bf, g_MsgParam3, sizeof(g_MsgParam3), false); + BfReadString(bf, g_MsgParam4, sizeof(g_MsgParam4), false); + } // Check which clients need to be excluded. g_MsgPlayersNum = 0; @@ -857,7 +875,10 @@ public Action Hook_UserMessageSendAudio(UserMsg msg_id, Handle bf, const int[] p else if(g_MsgClient == -2) return Plugin_Handled; - BfReadString(bf, g_MsgRadioSound, sizeof(g_MsgRadioSound), false); + if(g_bIsProtoBuf) + PbReadString(bf, "radio_sound", g_MsgRadioSound, sizeof(g_MsgRadioSound)); + else + BfReadString(bf, g_MsgRadioSound, sizeof(g_MsgRadioSound), false); if(StrEqual(g_MsgRadioSound, "radio.locknload")) return Plugin_Continue; @@ -904,17 +925,33 @@ public void OnPlayerRadio(DataPack pack) CloseHandle(pack); Handle RadioText = StartMessage("RadioText", g_MsgPlayers, playersNum, USERMSG_RELIABLE | USERMSG_BLOCKHOOKS); - BfWriteByte(RadioText, g_MsgDest); - BfWriteByte(RadioText, g_MsgClient); - BfWriteString(RadioText, g_MsgName); - BfWriteString(RadioText, g_MsgParam1); - BfWriteString(RadioText, g_MsgParam2); - BfWriteString(RadioText, g_MsgParam3); - BfWriteString(RadioText, g_MsgParam4); + if(g_bIsProtoBuf) + { + PbSetInt(RadioText, "msg_dst", g_MsgDest); + PbSetInt(RadioText, "client", g_MsgClient); + PbSetString(RadioText, "msg_name", g_MsgName); + PbSetString(RadioText, "params", g_MsgParam1, 0); + PbSetString(RadioText, "params", g_MsgParam2, 1); + PbSetString(RadioText, "params", g_MsgParam3, 2); + PbSetString(RadioText, "params", g_MsgParam4, 3); + } + else + { + BfWriteByte(RadioText, g_MsgDest); + BfWriteByte(RadioText, g_MsgClient); + BfWriteString(RadioText, g_MsgName); + BfWriteString(RadioText, g_MsgParam1); + BfWriteString(RadioText, g_MsgParam2); + BfWriteString(RadioText, g_MsgParam3); + BfWriteString(RadioText, g_MsgParam4); + } EndMessage(); Handle SendAudio = StartMessage("SendAudio", g_MsgPlayers, playersNum, USERMSG_RELIABLE | USERMSG_BLOCKHOOKS); - BfWriteString(SendAudio, g_MsgRadioSound); + if(g_bIsProtoBuf) + PbSetString(SendAudio, "radio_sound", g_MsgRadioSound); + else + BfWriteString(SendAudio, g_MsgRadioSound); EndMessage(); } diff --git a/Spectate/scripting/Spectate.sp b/Spectate/scripting/Spectate.sp index 5ef9f61c..96c14a74 100644 --- a/Spectate/scripting/Spectate.sp +++ b/Spectate/scripting/Spectate.sp @@ -11,7 +11,7 @@ public Plugin myinfo = name = "Spectate", description = "Adds a command to spectate specific players and removes broken spectate mode.", author = "Obus + BotoX", - version = "1.0", + version = "1.0.1", url = "" } @@ -49,7 +49,7 @@ public void OnClientSettingsChanged(int client) if (iObserverMode == OBS_MODE_POI) { ClientCommand(client, "cl_spec_mode %d", OBS_MODE_ROAMING); - if(IsClientInGame(client)) + if(IsClientInGame(client) && !IsPlayerAlive(client)) SetEntProp(client, Prop_Send, "m_iObserverMode", OBS_MODE_ROAMING); } } diff --git a/WeaponCleaner/scripting/WeaponCleaner.sp b/WeaponCleaner/scripting/WeaponCleaner.sp index ad7fc74e..c1706210 100644 --- a/WeaponCleaner/scripting/WeaponCleaner.sp +++ b/WeaponCleaner/scripting/WeaponCleaner.sp @@ -127,6 +127,8 @@ public void OnEntityDestroyed(int entity) public void OnWeaponSpawned(int entity) { + SDKUnhook(entity, SDKHook_Spawn, OnWeaponSpawned); + int HammerID = GetEntProp(entity, Prop_Data, "m_iHammerID"); // Should not be cleaned since it's a map spawned weapon if(HammerID) diff --git a/sourcebans/scripting/sbchecker.sp b/sourcebans/scripting/sbchecker.sp index 6fad74cb..41128a64 100644 --- a/sourcebans/scripting/sbchecker.sp +++ b/sourcebans/scripting/sbchecker.sp @@ -25,7 +25,7 @@ // ************************************************************************* #include -#define VERSION "(SB++) 1.5.5" +#define VERSION "(SB++) 1.5.5-dev" #define LISTBANS_USAGE "sm_listsbbans <#userid|name> - Lists a user's prior bans from Sourcebans" #define INVALID_TARGET -1 diff --git a/sourcebans/scripting/sourcebans.sp b/sourcebans/scripting/sourcebans.sp index 4698b540..bc030ee9 100644 --- a/sourcebans/scripting/sourcebans.sp +++ b/sourcebans/scripting/sourcebans.sp @@ -32,8 +32,8 @@ #include //#tryinclude -#define SB_VERSION "1.5.5F" -#define SBR_VERSION "1.5.5" +#define SB_VERSION "1.5.5F-dev" +#define SBR_VERSION "1.5.5-dev" #if defined _updater_included #define UPDATE_URL "https://sarabveer.github.io/SourceBans-Fork/updater/updatefile.txt" diff --git a/sourcebans/scripting/sourcecomms.sp b/sourcebans/scripting/sourcecomms.sp index a649be7c..83aa8847 100644 --- a/sourcebans/scripting/sourcecomms.sp +++ b/sourcebans/scripting/sourcecomms.sp @@ -42,7 +42,7 @@ // Do not edit below this line // //-----------------------------// -#define PLUGIN_VERSION "(SB++) 1.5.6" +#define PLUGIN_VERSION "(SB++) 1.5.5-dev" #define PREFIX "\x04[SourceComms]\x01 " #define MAX_TIME_MULTI 30 // maximum mass-target punishment length diff --git a/voiceannounce_ex/gamedata/voiceannounce_ex.games.txt b/voiceannounce_ex/gamedata/voiceannounce_ex.games.txt index 3c5da571..1f02a172 100644 --- a/voiceannounce_ex/gamedata/voiceannounce_ex.games.txt +++ b/voiceannounce_ex/gamedata/voiceannounce_ex.games.txt @@ -8,14 +8,14 @@ "engine" "css" "engine" "csgo" } - + "Addresses" { "CBaseServer" { "windows" { - "signature" "CVEngineServer::CreateFakeClient" + "signature" "CVEngineServer::CreateFakeClient" "read" "8" } "linux" @@ -28,7 +28,7 @@ } } } - + "Signatures" { "CVEngineServer::CreateFakeClient" @@ -36,7 +36,7 @@ "library" "engine" "windows" "\x55\x8B\xEC\xFF\x75\x08\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x85\xC0\x75\x04" } - + "sv" { "library" "engine" @@ -45,7 +45,7 @@ } } } - + "#default" { "#supported" @@ -54,14 +54,14 @@ "engine" "left4dead" "engine" "left4dead2" } - + "Addresses" { "CBaseServer" { "windows" { - "signature" "CVEngineServer::CreateFakeClient" + "signature" "CVEngineServer::CreateFakeClient" "read" "6" } "linux" @@ -74,7 +74,7 @@ } } } - + "Signatures" { "CVEngineServer::CreateFakeClient" @@ -82,7 +82,7 @@ "library" "engine" "windows" "\x8B\x44\x24\x04\x50\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x85\xC0" } - + "sv" { "library" "engine" @@ -91,7 +91,7 @@ } } } - + "#default" { "#supported" @@ -100,7 +100,7 @@ "engine" "orangebox_valve" "engine" "css" } - + "Offsets" { "CBaseServer::GetClient" @@ -109,14 +109,14 @@ "linux" "7" "mac" "7" } - + "CBaseClient::GetPlayerSlot" { "windows" "14" "linux" "15" "mac" "15" } - + "CGameClient::ProcessVoiceData" { "windows" "7" @@ -125,7 +125,7 @@ } } } - + "#default" { "#supported" @@ -134,7 +134,7 @@ "engine" "left4dead2" "engine" "csgo" } - + "Offsets" { "CBaseServer::GetClient" @@ -143,14 +143,14 @@ "linux" "7" "mac" "7" } - + "CBaseClient::GetPlayerSlot" { "windows" "14" "linux" "15" "mac" "15" } - + "CGameClient::ProcessVoiceData" { "windows" "8" @@ -159,6 +159,7 @@ } } } + "csgo" { "Offsets" @@ -167,6 +168,33 @@ { "windows" "513" "linux" "514" + "mac" "514" + } + } + } + + "left4dead" + { + "Offsets" + { + "OnVoiceTransmit" + { + "windows" "461" + "linux" "462" + "mac" "462" + } + } + } + + "left4dead2" + { + "Offsets" + { + "OnVoiceTransmit" + { + "windows" "485" + "linux" "486" + "mac" "486" } } }