added anti longknife feature
This commit is contained in:
parent
cea1b84965
commit
71d5c297d3
@ -337,6 +337,10 @@ zr_infect_consecutive_block "1"
|
||||
// Default: "1"
|
||||
zr_infect_weapons_drop "1"
|
||||
|
||||
// The maximum allowed distance between a client and an attacker for a successful infection. [0.0 = Disabled]
|
||||
// Default: "80.0"
|
||||
zr_infect_max_distance "80.0"
|
||||
|
||||
// Effects
|
||||
|
||||
// Disabling this will disable the fireball, smoke cloud, and sparks in a more efficient way.
|
||||
|
@ -109,6 +109,7 @@ enum CvarsList
|
||||
Handle:CVAR_INFECT_MZOMBIE_MAX,
|
||||
Handle:CVAR_INFECT_MZOMBIE_COUNTDOWN,
|
||||
Handle:CVAR_INFECT_MZOMBIE_RESPAWN,
|
||||
Handle:CVAR_INFECT_MAX_DISTANCE,
|
||||
Handle:CVAR_INFECT_EXPLOSION,
|
||||
Handle:CVAR_INFECT_FIREBALL,
|
||||
Handle:CVAR_INFECT_SMOKE,
|
||||
@ -327,6 +328,7 @@ CvarsCreate()
|
||||
g_hCvarsList[CVAR_INFECT_SPAWNTIME_MAX] = CreateConVar("zr_infect_spawntime_max", "50.0", "Maximum time from the start of the round until picking the mother zombie(s).");
|
||||
g_hCvarsList[CVAR_INFECT_CONSECUTIVE_BLOCK] = CreateConVar("zr_infect_consecutive_block", "1", "Prevent a player from being chosen as mother zombie two rounds in a row.");
|
||||
g_hCvarsList[CVAR_INFECT_WEAPONS_DROP] = CreateConVar("zr_infect_weapons_drop", "1", "Force player to drop all weapons on infect, disabling this will strip weapons instead.");
|
||||
g_hCvarsList[CVAR_INFECT_MAX_DISTANCE] = CreateConVar("zr_infect_max_distance", "80.0", "The maximum allowed distance between a client and an attacker for a successful infection. [0.0 = Disabled]");
|
||||
|
||||
// Effects
|
||||
g_hCvarsList[CVAR_INFECT_EXPLOSION] = CreateConVar("zr_infect_explosion", "1", "Disabling this will disable the fireball, smoke cloud, and sparks in a more efficient way.");
|
||||
|
@ -340,6 +340,25 @@ public ZRTools_Action:DamageOnTakeDamage(client, inflictor, attacker, Float:dama
|
||||
return immunityAction;
|
||||
}
|
||||
|
||||
// Check if distance between clients is too high. (Anti lagcompensation / longknife)
|
||||
new Float:maxDistance = GetConVarFloat(g_hCvarsList[CVAR_INFECT_MAX_DISTANCE]);
|
||||
if (maxDistance != 0.0)
|
||||
{
|
||||
new Float:clientPosition[3];
|
||||
new Float:attackerPosition[3];
|
||||
|
||||
GetClientAbsOrigin(client, clientPosition);
|
||||
GetClientAbsOrigin(attacker, attackerPosition);
|
||||
|
||||
new Float:distance = GetVectorDistance(clientPosition, attackerPosition);
|
||||
|
||||
// Block infection if distance is higher than allowed.
|
||||
if (distance > maxDistance)
|
||||
{
|
||||
return Plugin_Handled;
|
||||
}
|
||||
}
|
||||
|
||||
// Client is about to be infected, re-add HP so they aren't killed by
|
||||
// knife. But only do this when immunity mode is disabled.
|
||||
if (ClassGetImmunityMode(client) == Immunity_None)
|
||||
|
Loading…
Reference in New Issue
Block a user