Fixed jump boost :D Changed how bunnyhop prevention works.

This commit is contained in:
Greyscale 2009-06-23 14:28:26 -07:00
parent a0381a7096
commit d9843c74fa
4 changed files with 12 additions and 19 deletions

View File

@ -572,8 +572,8 @@ zr_jumpboost_bhop_protect "1"
zr_jumpboost_bhop_max "300"
// This is the horizontal jump multiplier for when the max limit is exceeded. ['0.9' = 90% of the jumps original magnitude | '>1.0' = Redundant | Dependency: zr_jumpboost_bhop_protect&zr_jumpboost_bhop_max]
// Default: "0.9"
zr_jumpboost_bhop_reset "0.9"
// Default: "0.75"
zr_jumpboost_bhop_scale "0.75"
// ----------------------------------------------------------------------------

View File

@ -169,14 +169,6 @@ public OnConfigsExecuted()
ClassOnModulesLoaded();
}
/**
* Client cookies just finished loading from the database.
*/
public OnClientCookiesCached()
{
// Forward event to modules.
}
/**
* Client is joining the server.
*

View File

@ -137,7 +137,7 @@ enum CvarsList
Handle:CVAR_NAPALM_IGNITE,
Handle:CVAR_JUMPBOOST_BHOP_PROTECT,
Handle:CVAR_JUMPBOOST_BHOP_MAX,
Handle:CVAR_JUMPBOOST_BHOP_RESET,
Handle:CVAR_JUMPBOOST_BHOP_SCALE,
Handle:CVAR_VOL,
Handle:CVAR_VOL_UPDATE_INTERVAL,
Handle:CVAR_VOL_TRIGGER_INTERVAL,
@ -413,7 +413,7 @@ CvarsCreate()
// ===========================
g_hCvarsList[CVAR_JUMPBOOST_BHOP_PROTECT] = CreateConVar("zr_jumpboost_bhop_protect", "1", "Prevent players from using forward jump boost multipliers to bunny hop.");
g_hCvarsList[CVAR_JUMPBOOST_BHOP_MAX] = CreateConVar("zr_jumpboost_bhop_max", "300", "The maximum horizontal velocity a player can achieve before bunnyhop protection kicks in. [Dependency: zr_jumpboost_bhop_protect]");
g_hCvarsList[CVAR_JUMPBOOST_BHOP_RESET] = CreateConVar("zr_jumpboost_bhop_reset", "0.9", "This is the horizontal jump multiplier for when the max limit is exceeded. ['0.9' = 90% of the jumps original magnitude | '>1.0' = Redundant | Dependency: zr_jumpboost_bhop_protect&zr_jumpboost_bhop_max]");
g_hCvarsList[CVAR_JUMPBOOST_BHOP_SCALE] = CreateConVar("zr_jumpboost_bhop_scale", "0.75", "This is the horizontal jump multiplier for when the max limit is exceeded. ['0.75' = 75% of the jumps original magnitude | '>1.0' = Redundant | Dependency: zr_jumpboost_bhop_protect&zr_jumpboost_bhop_max]");
// ===========================

View File

@ -41,14 +41,15 @@ JumpBoostOnClientJumpPost(client)
// Get client's current velocity.
ToolsClientVelocity(client, vecVelocity, false);
// Protect against bunnyhop.
JumpBoostBHopProtect(vecVelocity, distancemultiplier);
// Apply multipliers to jump vector.
vecVelocity[0] *= distancemultiplier;
vecVelocity[1] *= distancemultiplier;
vecVelocity[2] *= heightmultiplier;
// Protect against bunnyhop.
JumpBoostBHopProtect(vecVelocity, distancemultiplier);
// Set new velocity.
ToolsClientVelocity(client, vecVelocity, true, false);
}
@ -78,10 +79,10 @@ stock JumpBoostBHopProtect(Float:vecVelocity[], Float:distancemultiplier)
return;
}
// If we are resetting the velocity, then set to 1.0 (normal jump)
new Float:bunnyhopreset = GetConVarFloat(g_hCvarsList[CVAR_JUMPBOOST_BHOP_RESET]);
// Now we must scale the jump.
new Float:bunnyhopscale = GetConVarFloat(g_hCvarsList[CVAR_JUMPBOOST_BHOP_SCALE]);
// Scale with cvar value.
vecVelocity[0] /= (distancemultiplier / bunnyhopreset);
vecVelocity[1] /= (distancemultiplier / bunnyhopreset);
vecVelocity[0] *= (magnitude * bunnyhopscale) / magnitude;
vecVelocity[1] *= (magnitude * bunnyhopscale) / magnitude;
}