added cs: go support to SelfMute, WeaponCleaner and voiceannounce_ex

fixed sourcebans version by request
fixed awful bug in spectate plugin
This commit is contained in:
BotoX 2016-05-19 16:12:34 +02:00
parent 8d50f9f849
commit 5ba8cae70a
8 changed files with 110 additions and 41 deletions

View File

@ -4,6 +4,8 @@
#include <sdkhooks>
#include <zombiereloaded>
#pragma newdecls required
public Plugin myinfo =
{
name = "PlayerVisibility",

View File

@ -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();
}

View File

@ -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);
}
}

View File

@ -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)

View File

@ -25,7 +25,7 @@
// *************************************************************************
#include <sourcemod>
#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

View File

@ -32,8 +32,8 @@
#include <adminmenu>
//#tryinclude <updater>
#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"

View File

@ -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

View File

@ -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"
}
}
}