From 54eca07b3ef12b129112fd0e3033ec6f3d1cc270 Mon Sep 17 00:00:00 2001 From: zaCade Date: Sun, 27 Aug 2017 21:53:58 +0200 Subject: [PATCH] CSGO, weaponcleaner workaround.. (Its shit) --- WeaponCleaner/scripting/WeaponCleaner.sp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/WeaponCleaner/scripting/WeaponCleaner.sp b/WeaponCleaner/scripting/WeaponCleaner.sp index cdc2be66..c3b95349 100644 --- a/WeaponCleaner/scripting/WeaponCleaner.sp +++ b/WeaponCleaner/scripting/WeaponCleaner.sp @@ -15,6 +15,8 @@ int g_RealRoundStartedTime; int g_MaxWeapons; int g_MaxWeaponLifetime; +bool g_bEnableCSGOFix; + #define MAX_WEAPONS MAXPLAYERS int G_WeaponArray[MAX_WEAPONS][2]; @@ -30,6 +32,8 @@ public Plugin myinfo = public void OnPluginStart() { + g_bEnableCSGOFix = view_as(GetEngineVersion() == Engine_CSGO); + g_CVar_MaxWeapons = CreateConVar("sm_weaponcleaner_max", "5", "The maximum amount of weapons allowed in the game.", 0, true, 0.0, true, MAX_WEAPONS - 1.0); g_MaxWeapons = g_CVar_MaxWeapons.IntValue; g_CVar_MaxWeapons.AddChangeHook(OnConVarChanged); @@ -138,7 +142,19 @@ public void OnEntityDestroyed(int entity) public void OnWeaponSpawned(int entity) { - //SDKUnhook(entity, SDKHook_Spawn, OnWeaponSpawned); + if (g_bEnableCSGOFix) + { + SDKUnhook(entity, SDKHook_Spawn, OnWeaponSpawned); + + RequestFrame(OnWeaponSpawnedPost, entity); + } + else OnWeaponSpawnedPost(entity); +} + +public void OnWeaponSpawnedPost(int entity) +{ + if(!IsValidEntity(entity)) + return; int HammerID = GetEntProp(entity, Prop_Data, "m_iHammerID"); // Should not be cleaned since it's a map spawned weapon