just updating plugins to 64bit support

This commit is contained in:
jenz
2026-11-22 22:12:20 +01:00
parent 7a4f26c2bd
commit 2dca39be8a
32 changed files with 2990 additions and 516 deletions
+74
View File
@@ -0,0 +1,74 @@
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <sdkhooks>
#include <sdktools>
#include <dhooks>
DynamicHook g_hRadiusDamage;
public Plugin myinfo =
{
name = "Napalm Lag Fix",
author = "GoD-Tony + BotoX",
description = "Prevents lag when napalm is used on players",
version = "1.0.8",
url = "https://forums.alliedmods.net/showthread.php?t=188093"
};
public void OnPluginStart()
{
// Gamedata.
GameData hConfig = new GameData("fixnapalmlag.games");
if (!hConfig)
SetFailState("Could not find gamedata file: fixnapalmlag.games.txt");
int offset = hConfig.GetOffset("RadiusDamage");
if (offset == -1)
{
delete hConfig;
SetFailState("Failed to find RadiusDamage offset");
}
delete hConfig;
// DHooks
g_hRadiusDamage = new DynamicHook(offset, HookType_GameRules, ReturnType_Void, ThisPointer_Ignore);
g_hRadiusDamage.AddParam(HookParamType_ObjectPtr); // 1 - CTakeDamageInfo &info
g_hRadiusDamage.AddParam(HookParamType_VectorPtr); // 2 - Vector &vecSrc
g_hRadiusDamage.AddParam(HookParamType_Float); // 3 - float flRadius
g_hRadiusDamage.AddParam(HookParamType_Int); // 4 - int iClassIgnore
g_hRadiusDamage.AddParam(HookParamType_CBaseEntity); // 5 - CBaseEntity *pEntityIgnore
}
public void OnMapStart()
{
g_hRadiusDamage.HookGamerules(Hook_Pre, Hook_RadiusDamage);
}
public MRESReturn Hook_RadiusDamage(DHookParam hParams)
{
if (hParams.IsNull(5))
return MRES_Ignored;
int iDmgBits = hParams.GetObjectVar(1, 60, ObjectValueType_Int);
int iEntIgnore = hParams.Get(5);
if (!(iDmgBits & DMG_BURN))
return MRES_Ignored;
// Block napalm damage if it's coming from another client.
if (iEntIgnore >= 1 && iEntIgnore <= MaxClients)
return MRES_Supercede;
// Block napalm that comes from grenades
char sEntClassName[64];
if (GetEntityClassname(iEntIgnore, sEntClassName, sizeof(sEntClassName)))
{
if (!strcmp(sEntClassName, "hegrenade_projectile"))
return MRES_Supercede;
}
return MRES_Ignored;
}
-71
View File
@@ -1,71 +0,0 @@
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <sdkhooks>
#include <sdktools>
#include <dhooks>
Handle g_hRadiusDamage = INVALID_HANDLE;
public Plugin myinfo =
{
name = "Napalm Lag Fix",
author = "GoD-Tony + BotoX",
description = "Prevents lag when napalm is used on players",
version = "1.0.4",
url = "https://forums.alliedmods.net/showthread.php?t=188093"
};
public void OnPluginStart()
{
// Gamedata.
Handle hConfig = LoadGameConfigFile("napalmlagfix.games");
if(hConfig == INVALID_HANDLE)
SetFailState("Could not find gamedata file: napalmlagfix.games.txt");
int offset = GameConfGetOffset(hConfig, "RadiusDamage");
if(offset == -1)
SetFailState("Failed to find RadiusDamage offset");
CloseHandle(hConfig);
// DHooks
g_hRadiusDamage = DHookCreate(offset, HookType_GameRules, ReturnType_Void, ThisPointer_Ignore, Hook_RadiusDamage);
DHookAddParam(g_hRadiusDamage, HookParamType_ObjectPtr); // 1 - CTakeDamageInfo &info
DHookAddParam(g_hRadiusDamage, HookParamType_VectorPtr); // 2 - Vector &vecSrc
DHookAddParam(g_hRadiusDamage, HookParamType_Float); // 3 - float flRadius
DHookAddParam(g_hRadiusDamage, HookParamType_Int); // 4 - int iClassIgnore
DHookAddParam(g_hRadiusDamage, HookParamType_CBaseEntity); // 5 - CBaseEntity *pEntityIgnore
}
public void OnMapStart()
{
DHookGamerules(g_hRadiusDamage, false);
}
public MRESReturn Hook_RadiusDamage(Handle hParams)
{
if(DHookIsNullParam(hParams, 5))
return MRES_Ignored;
int iDmgBits = DHookGetParamObjectPtrVar(hParams, 1, 60, ObjectValueType_Int);
int iEntIgnore = DHookGetParam(hParams, 5);
if(!(iDmgBits & DMG_BURN))
return MRES_Ignored;
// Block napalm damage if it's coming from another client.
if(1 <= iEntIgnore <= MaxClients)
return MRES_Supercede;
// Block napalm that comes from grenades
char sEntClassName[64];
if(GetEntityClassname(iEntIgnore, sEntClassName, sizeof(sEntClassName)))
{
if(!strcmp(sEntClassName, "hegrenade_projectile"))
return MRES_Supercede;
}
return MRES_Ignored;
}