Changed hardcoded antistick force into a CVAR.

This commit is contained in:
richard 2009-01-16 15:30:37 +01:00
parent 018e283679
commit 72cb683278
4 changed files with 87 additions and 76 deletions

View File

@ -1,3 +1,6 @@
2009.01.16 - 2.5.1.22
* Changed hardcoded antistick force into a CVAR.
2009.01.14 - 2.5.1.21 2009.01.14 - 2.5.1.21
* Fixed spectactor admins not able to teleport players to their custom location. * Fixed spectactor admins not able to teleport players to their custom location.

View File

@ -15,7 +15,7 @@
#undef REQUIRE_PLUGIN #undef REQUIRE_PLUGIN
#include <market> #include <market>
#define VERSION "2.5.1.21" #define VERSION "2.5.1.22"
#include "zr/zombiereloaded" #include "zr/zombiereloaded"
#include "zr/global" #include "zr/global"

View File

@ -80,7 +80,8 @@ enum ZRSettings
Handle:CVAR_INFECT_SHAKE, Handle:CVAR_INFECT_SHAKE,
Handle:CVAR_INFECT_SHAKE_AMP, Handle:CVAR_INFECT_SHAKE_AMP,
Handle:CVAR_INFECT_SHAKE_FREQUENCY, Handle:CVAR_INFECT_SHAKE_FREQUENCY,
Handle:CVAR_INFECT_SHAKE_DURATION Handle:CVAR_INFECT_SHAKE_DURATION,
Handle:CVAR_INFECT_ANTISTICK_FORCE
} }
new gCvars[ZRSettings]; new gCvars[ZRSettings];
@ -160,6 +161,7 @@ CreateCvars()
gCvars[CVAR_INFECT_SHAKE_AMP] = CreateConVar("zr_infect_shake_amp", "15.0", "Amplitude of the shake, when zr_infect_shake is 1"); gCvars[CVAR_INFECT_SHAKE_AMP] = CreateConVar("zr_infect_shake_amp", "15.0", "Amplitude of the shake, when zr_infect_shake is 1");
gCvars[CVAR_INFECT_SHAKE_FREQUENCY] = CreateConVar("zr_infect_shake_frequency", "1.0", "Frequency of the shake, when zr_infect_shake is 1"); gCvars[CVAR_INFECT_SHAKE_FREQUENCY] = CreateConVar("zr_infect_shake_frequency", "1.0", "Frequency of the shake, when zr_infect_shake is 1");
gCvars[CVAR_INFECT_SHAKE_DURATION] = CreateConVar("zr_infect_shake_duration", "5.0", "Duration of the shake, when zr_infect_shake is 1"); gCvars[CVAR_INFECT_SHAKE_DURATION] = CreateConVar("zr_infect_shake_duration", "5.0", "Duration of the shake, when zr_infect_shake is 1");
gCvars[CVAR_INFECT_ANTISTICK_FORCE] = CreateConVar("zr_infect_antistick_force", "-160.0", "Force to push away players from eachother on infection. Negative values push away, positive values pull. (0: Disable)");
HookConVarChange(gCvars[CVAR_ENABLE], EnableHook); HookConVarChange(gCvars[CVAR_ENABLE], EnableHook);

View File

@ -657,6 +657,12 @@ AntiStick(attacker, client)
return; return;
} }
new Float:force = GetConVarFloat(gCvars[CVAR_INFECT_ANTISTICK_FORCE]);
if (force == 0.0)
{
return;
}
new Float:vector[3]; new Float:vector[3];
new Float:attackerloc[3]; new Float:attackerloc[3];
@ -668,7 +674,7 @@ AntiStick(attacker, client)
MakeVectorFromPoints(attackerloc, clientloc, vector); MakeVectorFromPoints(attackerloc, clientloc, vector);
NormalizeVector(vector, vector); NormalizeVector(vector, vector);
ScaleVector(vector, -160.0); ScaleVector(vector, force);
TeleportEntity(attacker, NULL_VECTOR, NULL_VECTOR, vector); TeleportEntity(attacker, NULL_VECTOR, NULL_VECTOR, vector);
} }