summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornavewindre <nw@moneybot.cc>2023-12-02 14:55:18 +0100
committernavewindre <nw@moneybot.cc>2023-12-02 14:55:18 +0100
commit2cb2a356c012cc34af811f26e16d26b11e663768 (patch)
tree29fd8c6fd96cd85323034caf588815b8447ad83c
parenta22914735903c4495b3af453668bf316111e5126 (diff)
jumpbug stats, weirdjump stats.
-rw-r--r--sourcemod-1.5-dev/scripting/ljstats.sp198
1 files changed, 96 insertions, 102 deletions
diff --git a/sourcemod-1.5-dev/scripting/ljstats.sp b/sourcemod-1.5-dev/scripting/ljstats.sp
index 202dd9b..e9d535b 100644
--- a/sourcemod-1.5-dev/scripting/ljstats.sp
+++ b/sourcemod-1.5-dev/scripting/ljstats.sp
@@ -17,7 +17,7 @@
#define LJTOP_DIR "configs/ljstats/"
#define LJTOP_FILE "ljtop.txt"
-#define LJTOP_NUM_ENTRIES 50
+#define LJTOP_NUM_ENTRIES 500
#define LJSOUND_NUM 5
#define MAX_STRAFES 50
#define BHOP_TIME 0.3
@@ -33,6 +33,8 @@
#define BJ_HEIGHT_DELTA_MAX 2.0
#define LAJ_HEIGHT_DELTA_MIN -6.0
#define LAJ_HEIGHT_DELTA_MAX 0.0
+#define JB_HEIGHT_DELTA_MIN -4
+#define JB_HEIGHT_DELTA_MAX 1.0
#define HUD_HINT_SIZE 256
#define STRAFE_TRAINER_TICKS 9
@@ -69,6 +71,8 @@ enum PlayerState
bool:bDuck,
bool:bLastDuckState,
bool:bSecondLastDuckState,
+ bool:bJumpBug,
+ bool:bDuckJump,
JUMP_DIRECTION:JumpDir,
ILLEGAL_JUMP_FLAGS:IllegalJumpFlags,
@@ -180,6 +184,7 @@ enum JUMP_TYPE
{
JT_LONGJUMP,
JT_COUNTJUMP,
+ JT_JUMPBUG,
JT_WEIRDJUMP,
JT_BHOPJUMP,
JT_LADDERJUMP,
@@ -228,6 +233,8 @@ enum LJTOP_TABLE
LT_CJ,
LT_BJ,
LT_LAJ,
+ LT_WJ,
+ LT_JB,
LT_END
}
@@ -238,7 +245,9 @@ new String:g_strLJTopTags[LT_END][] =
"bwlj",
"cj",
"bj",
- "laj"
+ "laj",
+ "wj",
+ "jb"
};
new String:g_strLJTopTableName[LT_END][] =
@@ -248,7 +257,9 @@ new String:g_strLJTopTableName[LT_END][] =
"Backwards longjump",
"Countjump",
"Bhopjump",
- "Ladderjump"
+ "Ladderjump",
+ "Weirdjump",
+ "Jumpbug"
};
new String:g_strLJTopOutput[LT_END][] =
@@ -258,13 +269,16 @@ new String:g_strLJTopOutput[LT_END][] =
"backwards lj",
"countjump",
"bhopjump",
- "ladderjump"
+ "ladderjump",
+ "weirdjump",
+ "jumpbug"
};
new String:g_strJumpType[JT_END][] =
{
"Longjump",
"Countjump",
+ "Jumpbug",
"Weirdjump",
"Bhopjump",
"Ladderjump",
@@ -276,6 +290,7 @@ new String:g_strJumpTypeLwr[JT_END][] =
{
"longjump",
"countjump",
+ "jumpbug",
"weirdjump",
"bhopjump",
"ladderjump",
@@ -287,6 +302,7 @@ new String:g_strJumpTypeShort[JT_END][] =
{
"LJ",
"CJ",
+ "JB",
"WJ",
"BJ",
"LAJ",
@@ -298,6 +314,7 @@ new const Float:g_fHeightDeltaMin[JT_END] =
{
LJ_HEIGHT_DELTA_MIN,
LJ_HEIGHT_DELTA_MIN,
+ JB_HEIGHT_DELTA_MIN,
WJ_HEIGHT_DELTA_MIN,
BJ_HEIGHT_DELTA_MIN,
LAJ_HEIGHT_DELTA_MIN,
@@ -309,6 +326,7 @@ new const Float:g_fHeightDeltaMax[JT_END] =
{
LJ_HEIGHT_DELTA_MAX,
LJ_HEIGHT_DELTA_MAX,
+ JB_HEIGHT_DELTA_MAX,
WJ_HEIGHT_DELTA_MAX,
BJ_HEIGHT_DELTA_MAX,
LAJ_HEIGHT_DELTA_MAX,
@@ -399,7 +417,7 @@ new bool:g_bLJScoutStats = false;
new Float:g_fLJNoDuckMin = 256.0;
new Float:g_fLJClientMin = 0.0;
new Float:g_fWJMin = 270.0;
-new Float:g_fWJDropMax = 30.0;
+new Float:g_fWJDropMax = 48.0;
new Float:g_fBJMin = 270.0;
new Float:g_fBJMax = 265.0;
new Float:g_fLAJMin = 140.0;
@@ -444,7 +462,7 @@ public OnPluginStart()
g_hCvarLJNoDuckMin = CreateCvar("ljstats_lj_noduck_min", "256");
g_hCvarLJClientMin = CreateCvar("ljstats_lj_client_min", "0.0");
g_hCvarWJMin = CreateCvar("ljstats_wj_min", "270");
- g_hCvarWJDropMax = CreateCvar("ljstats_wj_drop_max", "30.0");
+ g_hCvarWJDropMax = CreateCvar("ljstats_wj_drop_max", "48.0");
g_hCvarBJMin = CreateCvar("ljstats_bj_min", "270");
g_hCvarBJMax = CreateCvar("ljstats_bj_max", "265");
g_hCvarLAJMin = CreateCvar("ljstats_laj_min", "140");
@@ -870,7 +888,8 @@ public OnCvarChange(Handle:hCvar, const String:strOldValue[], const String:strNe
g_ColorTop[0] = (nColor & 0xFF0000) >> 16;
g_ColorTop[1] = (nColor & 0xFF00) >> 8;
g_ColorTop[2] = nColor & 0xFF;
- }
+ }
+
ON_CVAR_CHANGE_FLOAT(g_hCvarLJMin, g_fLJMin)
ON_CVAR_CHANGE_FLOAT(g_hCvarLJMax, g_fLJMax)
ON_CVAR_CHANGE_FLOAT(g_hCvarNonLJMax, g_fNonLJMax)
@@ -958,7 +977,7 @@ public OnMapStart()
public OnClientPutInServer(client)
{
/*
- #if defined LJSERV
+ #if defined LJSERV
g_PlayerStates[client][bLJEnabled] = true;
#else
g_PlayerStates[client][bLJEnabled] = true;
@@ -1221,7 +1240,7 @@ ShowSettingsPanel(client)
Format(buf, sizeof(buf), "Bhop stats: %s", g_PlayerStates[client][bShowBhopStats] ? "On" : "Off");
AddMenuItem(hMenu, "bhopstats", buf);
-
+
Format(buf, sizeof(buf), "Verbosity: %d", g_PlayerStates[client][nVerbosity]);
AddMenuItem(hMenu, "verbosity", buf);
@@ -1350,9 +1369,7 @@ public SettingsMenuHandler(Handle:hMenu, MenuAction:ma, client, nItem)
SetCookie(client, Handle:hCookie, n)
{
decl String:strCookie[64];
-
IntToString(n, strCookie, sizeof(strCookie));
-
SetClientCookie(client, hCookie, strCookie);
}
@@ -2356,6 +2373,14 @@ LJTopUpdate(client)
{
LJTopUpdateTable(client, LT_LAJ);
}
+ else if( g_PlayerStates[client][JumpType] == JT_JUMPBUG && g_PlayerStates[client][fJumpDistance] > g_LJTop[LT_JB][LJTOP_NUM_ENTRIES - 1][m_fDistance] )
+ {
+ LJTopUpdateTable(client, LT_JB);
+ }
+ else if( g_PlayerStates[client][JumpType] == JT_WEIRDJUMP && g_PlayerStates[client][fJumpDistance] > g_LJTop[LT_WJ][LJTOP_NUM_ENTRIES - 1][m_fDistance] )
+ {
+ LJTopUpdateTable(client, LT_WJ);
+ }
}
GetStrafeString( String:buffer[], maxlength, Float:percentage ) {
@@ -2465,15 +2490,14 @@ StrafeTrainer( client, bool: onGround, Float:angles[3], Float:velocity[3] ) {
g_PlayerStates[client][nTrainerTicks]++;
}
-Speedometer( client, bool: bJump, bool: bGround, Float:velocity[3] ) {
-
+Speedometer( client, bool: bJump, bool: bGround, bool: bIsDucking, Float:velocity[3] ) {
new Float:speed = GetVectorLength( velocity );
new String:sBuffer[64];
if( (g_PlayerStates[client][bOnGround] || g_PlayerStates[client][bOnLadder]) && !bJump ) {
g_PlayerStates[client][fJumpSpeed] = speed;
}
-
+
if( (!g_PlayerStates[client][bOnGround]) && bGround && bJump ) {
g_PlayerStates[client][bPerf] = true;
g_PlayerStates[client][fJumpSpeed] = speed;
@@ -2481,18 +2505,29 @@ Speedometer( client, bool: bJump, bool: bGround, Float:velocity[3] ) {
else if( bGround || g_PlayerStates[client][bOnLadder] ) {
g_PlayerStates[client][bPerf] = false;
g_PlayerStates[client][fJumpSpeed] = speed;
+ g_PlayerStates[client][bDuckJump] = false;
+ g_PlayerStates[client][bJumpBug] = false;
}
-
+
+ if( bJump && bGround )
+ g_PlayerStates[client][bDuckJump] = bIsDucking;
if( !g_PlayerStates[client][nSpeedometer] )
return;
Format(sBuffer, sizeof(sBuffer), "%.0f", speed );
if( !bGround && !g_PlayerStates[client][bOnLadder] ) {
Format(sBuffer, sizeof(sBuffer), "%s\n(%.0f)", sBuffer, g_PlayerStates[client][fJumpSpeed] );
+ if( g_PlayerStates[client][bDuckJump] )
+ Format(sBuffer, sizeof(sBuffer), "%sC", sBuffer );
}
new r, g, b;
- if( g_PlayerStates[client][bPerf] ) {
+ if( g_PlayerStates[client][bJumpBug] ) {
+ r = 255;
+ g = 255;
+ b = 0;
+ }
+ else if( g_PlayerStates[client][bPerf] ) {
r = b = 0;
g = 255;
}
@@ -2656,6 +2691,14 @@ public Action:Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroa
// cba with another enum so JT_LONGJUMP = jump, JT_DROP = slide off edge, JT_LADDERJUMP = ladder
PlayerJump(client, JUMP_TYPE:JumpType2 = JT_LONGJUMP)
{
+ if( !g_PlayerStates[client][bOnGround] && JumpType2 == JT_LONGJUMP ) {
+ g_PlayerStates[client][bJumpBug] = true;
+ g_PlayerStates[client][fJumpSpeed] = GetSpeed(client);
+ g_PlayerStates[client][bDuckJump] = false;
+ PlayerLand(client);
+ }
+ else g_PlayerStates[client][bJumpBug] = false;
+
g_PlayerStates[client][bOnGround] = false;
new Float:fTime = GetGameTime();
@@ -2710,13 +2753,21 @@ PlayerJump(client, JUMP_TYPE:JumpType2 = JT_LONGJUMP)
g_PlayerStates[client][LastJumpType] = g_PlayerStates[client][JumpType];
// Determine jump type
- if(JumpType2 == JT_DROP || JumpType2 == JT_LADDERJUMP)
+ if((JumpType2 == JT_DROP || JumpType2 == JT_LADDERJUMP) && !g_PlayerStates[client][bJumpBug])
{
g_PlayerStates[client][JumpType] = JumpType2;
}
else
{
- if(g_PlayerStates[client][nBhops] > 1)
+ if( g_PlayerStates[client][bJumpBug] ) {
+ if( g_PlayerStates[client][fPrestrafe] > 325.0 ) {
+ g_PlayerStates[client][IllegalJumpFlags] |= IJF_PRESTRAFE;
+ CPrintToChat(client, "Your jumpbug prestrafe was too high! {red}({default}%0.2f {red}> {default}325{red})", g_PlayerStates[client][fPrestrafe]);
+ }
+
+ g_PlayerStates[client][JumpType] = JT_JUMPBUG;
+ }
+ else if(g_PlayerStates[client][nBhops] > 1)
{
g_PlayerStates[client][JumpType] = JT_BHOP;
}
@@ -2726,6 +2777,12 @@ PlayerJump(client, JUMP_TYPE:JumpType2 = JT_LONGJUMP)
{
g_PlayerStates[client][fWJDropPre] = g_PlayerStates[client][fPrestrafe];
g_PlayerStates[client][JumpType] = JT_WEIRDJUMP;
+
+ new Float:height = FloatAbs( g_PlayerStates[client][fLastJumpHeightDelta] );
+ if( height > 64.0 ) {
+ g_PlayerStates[client][IllegalJumpFlags] |= IJF_PRESTRAFE;
+ CPrintToChat( client, "Your drop was too high for a weirdjump! {red}({default}%0.2f {red}> {default}64{red})", height );
+ }
}
else if(g_PlayerStates[client][fLastJumpHeightDelta] > HEIGHT_DELTA_MIN(JT_LONGJUMP))
{
@@ -2752,11 +2809,17 @@ PlayerJump(client, JUMP_TYPE:JumpType2 = JT_LONGJUMP)
// Jumpoff origin
new Float:vOrigin[3];
GetClientAbsOrigin(client, vOrigin);
+ if( g_PlayerStates[client][bJumpBug] ) {
+ new Float:vVel[3];
+ GetEntPropVector(client, Prop_Data, "m_vecVelocity", vVel);
+
+ vOrigin[2] += vVel[2] * GetTickInterval();
+ }
+
Array_Copy(vOrigin, g_PlayerStates[client][vJumpOrigin], 3);
-
+
// Prestrafe
g_PlayerStates[client][fPrestrafe] = GetSpeed(client);
-
if(g_PlayerStates[client][JumpType] == JT_LONGJUMP || g_PlayerStates[client][JumpType] == JT_COUNTJUMP)
{
if(g_PlayerStates[client][fPrestrafe] > g_fLJMaxPrestrafe)
@@ -3003,8 +3066,6 @@ _OnPlayerRunCmd(client, buttons, const Float:vOrigin[3], const Float:vAngles[3],
return;
}
-
-
if(g_PlayerStates[client][nSpectatorTarget] != -1)
{
g_PlayerStates[g_PlayerStates[client][nSpectatorTarget]][nSpectators]--;
@@ -3341,10 +3402,11 @@ public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:vAn
GetEntPropVector(client, Prop_Data, "m_vecVelocity", vVelocity);
new bool:jump = !!(buttons & IN_JUMP);
+ new bool:duck = !!(buttons & IN_DUCK);
new Float:vVelocitycopy[3];
Array_Copy( vVelocity, vVelocitycopy, 2 );
- Speedometer( client, jump, bGround, vVelocitycopy );
+ Speedometer( client, jump, bGround, duck, vVelocitycopy );
_OnPlayerRunCmd(client, buttons, vOrigin, vAngles, vVelocity, bDucked, bGround);
StrafeTrainer( client, bGround, vAngles, vVelocity );
@@ -3458,78 +3520,6 @@ PlayerLand(client)
}
}
- // Check whether the player actually moved past the block edge
- if(g_PlayerStates[client][bBlockMode] && !g_PlayerStates[client][bFailedBlock])
- {
- if(!g_PlayerStates[client][vBlockNormal][0] || !g_PlayerStates[client][vBlockNormal][1])
- {
- // bools are not actually handled as 1 bit bools but 32 bit cells so n = normal.y gives out of bounds exception
- // !!normal.y or !normal.x rather
- // pawn good
- new bool:n = !g_PlayerStates[client][vBlockNormal][0];
-
- if(g_PlayerStates[client][vBlockNormal][n] > 0.0)
- {
- if(vCurOrigin[n] + 16.0 * g_PlayerStates[client][vBlockNormal][n] < g_PlayerStates[client][vBlockEndPos][n])
- {
- g_PlayerStates[client][bFailedBlock] = true;
- }
- }
- else
- {
- if(vCurOrigin[n] + 16.0 * g_PlayerStates[client][vBlockNormal][n] > g_PlayerStates[client][vBlockEndPos][n])
- {
- g_PlayerStates[client][bFailedBlock] = true;
- }
- }
- }
- else
- {
- new Float:vAdjCurOrigin[3], Float:vInvNormal[3];
- vAdjCurOrigin = vCurOrigin;
- Array_Copy(g_PlayerStates[client][vBlockNormal], vInvNormal, 2);
- ScaleVector(vInvNormal, -1.0);
- Adjust(vAdjCurOrigin, vInvNormal);
-
-
- // f(endpos.x) + (origin.x - endpos.x) * b = (f(endpos.x) - endpos.x * b) + origin.x * b = f(0) + origin.x * b
- // block normal is perpendicular to the edge direction, so b = 1 / (normal rot 90).x
- // dx and dy should have same sign so ccw rot if facing down, cw rot if up
- new Float:b = 1 / (g_PlayerStates[client][vBlockNormal][0] < 0 ? g_PlayerStates[client][vBlockNormal][1] : -g_PlayerStates[client][vBlockNormal][1]);
- new Float:fPos = g_PlayerStates[client][vBlockEndPos][1] + (vAdjCurOrigin[0] - g_PlayerStates[client][vBlockEndPos][0]) * b;
-
- if(g_PlayerStates[client][vBlockNormal][1] > 0.0 ? vAdjCurOrigin[1] < fPos : vAdjCurOrigin[1] > fPos)
- {
- g_PlayerStates[client][bFailedBlock] = true;
- }
-
-
- #if defined DEBUG
- PrintToChat(client, "block normal: %.2f, %.2f\n%.2f, %.2f, %.2f",
- g_PlayerStates[client][vBlockNormal][0],
- g_PlayerStates[client][vBlockNormal][1],
- vAdjCurOrigin[1],
- fPos,
- g_PlayerStates[client][vBlockEndPos][1]);
-
- new Float:v1[3], Float:v2[3];
- v1[2] = g_PlayerStates[client][vBlockEndPos][2] + 0.1;
- v2[2] = g_PlayerStates[client][vBlockEndPos][2] + 0.1;
- v1[0] = g_PlayerStates[client][vBlockEndPos][0] - 50;
- v1[1] = g_PlayerStates[client][vBlockEndPos][1] + (v1[0] - g_PlayerStates[client][vBlockEndPos][0]) * b;
- v2[0] = g_PlayerStates[client][vBlockEndPos][0] + 50;
- v2[1] = g_PlayerStates[client][vBlockEndPos][1] + (v2[0] - g_PlayerStates[client][vBlockEndPos][0]) * b;
- CreateBeam2(v1, v2, 0, 0, 255);
-
- if(g_PlayerStates[client][bFailedBlock])
- {
- PrintToChat(client, "failedblocklongjump 2");
- }
- #endif
- }
- }
-
-
// sum sync
g_PlayerStates[client][fSync] = 0.0;
@@ -3925,15 +3915,15 @@ PlayerLand(client)
}
}
- case JT_WEIRDJUMP:
+ /*case JT_WEIRDJUMP:
{
if(g_fWJMin != 0.0 && g_PlayerStates[client][fJumpDistance] > g_fWJMin && (g_fWJDropMax == 0.0 || g_fWJDropMax >= FloatAbs(g_PlayerStates[client][fLastJumpHeightDelta])))
{
OutputJump(client, buf);
}
- }
+ }*/
- case JT_BHOPJUMP:
+ case JT_BHOPJUMP, JT_JUMPBUG, JT_WEIRDJUMP:
{
if(g_fBJMin != 0.0 && g_PlayerStates[client][fJumpDistance] >= g_fBJMin)
{
@@ -4013,20 +4003,24 @@ OutputJump(client, String:buf[1024])
decl String:strName[64];
GetClientName(client, strName, sizeof(strName));
- Format(strOutput, sizeof(strOutput), "%s {green}%s%sed ",
+ Format(strOutput, sizeof(strOutput), "%s {green}%s%s%s ",
strName,
g_PlayerStates[client][JumpType] == JT_BHOPJUMP && g_PlayerStates[client][bStamina] ? "easy" : "",
- g_strJumpTypeLwr[g_PlayerStates[client][JumpType]]);
+ g_strJumpTypeLwr[g_PlayerStates[client][JumpType]],
+ g_PlayerStates[client][JumpType] == JT_JUMPBUG ? "ged" : "ed");
if(g_PlayerStates[client][JumpType] != JT_LADDERJUMP)
{
- if(g_PlayerStates[client][JumpType] != JT_LONGJUMP && g_PlayerStates[client][JumpType] != JT_COUNTJUMP)
+ if(g_PlayerStates[client][JumpType] != JT_LONGJUMP
+ && g_PlayerStates[client][JumpType] != JT_COUNTJUMP )
{
fMax = g_fNonLJMax;
}
- if(g_PlayerStates[client][JumpType] == JT_BHOPJUMP)
+ if( g_PlayerStates[client][JumpType] == JT_BHOPJUMP
+ || g_PlayerStates[client][JumpType] == JT_JUMPBUG
+ || g_PlayerStates[client][JumpType] == JT_WEIRDJUMP )
{
fMin = g_fBJMin;
fMax = g_fBJMax;