Update DamageProxy.sp
This commit is contained in:
parent
e0773b7734
commit
b2eaf206c9
@ -30,6 +30,7 @@ char g_iPhysboxToClient[2048];
|
||||
|
||||
int g_iSpecialKnife[MAXPLAYERS + 1];
|
||||
bool g_bNoSlowdown[MAXPLAYERS + 1];
|
||||
bool g_bRestoreHP[MAXPLAYERS + 1]
|
||||
bool g_bFullKnife[MAXPLAYERS + 1];
|
||||
|
||||
KeyValues g_Config;
|
||||
@ -158,6 +159,8 @@ public void OnWeaponEquipped(int client, int entity)
|
||||
|
||||
g_bNoSlowdown[client] = view_as<bool>(g_Config.GetNum("NoSlowDown", 0));
|
||||
|
||||
g_bRestoreHP[client] = view_as<bool>(g_Config.GetNum("RestoreHP", 1));
|
||||
|
||||
g_bFullKnife[client] = view_as<bool>(g_Config.GetNum("FullKnife", 0));
|
||||
|
||||
g_iSpecialKnife[client] = entity;
|
||||
@ -173,6 +176,7 @@ public void OnWeaponDropped(int client, int entity)
|
||||
ZR_SetClientKnockbackScale(client, 1.0);
|
||||
g_iSpecialKnife[client] = 0;
|
||||
g_bNoSlowdown[client] = false;
|
||||
g_bRestoreHP[client] = false;
|
||||
g_bFullKnife[client] = false;
|
||||
}
|
||||
}
|
||||
@ -295,15 +299,22 @@ public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &dam
|
||||
flags &= ~(ZR_KNOCKBACK_SCALE | ZR_KNOCKBACK_LIMITVEL);
|
||||
}
|
||||
|
||||
float flVelocityModifier = 1.0;
|
||||
float flVelocityModifier;
|
||||
if(g_bNoSlowdown[client])
|
||||
flVelocityModifier = GetEntDataFloat(client, g_hVelocityModifier);
|
||||
|
||||
int iClientHealth;
|
||||
if(g_bRestoreHP[client])
|
||||
iClientHealth = GetClientHealth(client);
|
||||
|
||||
damagetype |= DMG_DROWN;
|
||||
SDKHooks_TakeDamage(victim, inflictor, attacker, damage, damagetype, weapon, damageForce, damagePosition, flags);
|
||||
|
||||
if(g_bNoSlowdown[client] && flVelocityModifier >= 0.99)
|
||||
SetEntDataFloat(client, g_hVelocityModifier, 1.0, true);
|
||||
if(g_bNoSlowdown[client])
|
||||
SetEntDataFloat(client, g_hVelocityModifier, flVelocityModifier, true);
|
||||
|
||||
if(g_bRestoreHP[client])
|
||||
SetEntityHealth(client, iClientHealth);
|
||||
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user