CSGO, weaponcleaner workaround.. (Its shit)

This commit is contained in:
zaCade 2017-08-27 21:53:58 +02:00
parent d4448802a4
commit 54eca07b3e

View File

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