Skip to content

Commit 0d7e681

Browse files
authored
Merge pull request #43 from olokos/limitspeed-fix
Fix prespeed exploit
2 parents c100c5f + 5077a6f commit 0d7e681

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

addons/sourcemod/scripting/SurfTimer.sp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@ char g_szMapNameFromDatabase[MAXPLAYERS + 1][128];
13381338
// New speed limit variables
13391339
bool g_bInBhop[MAXPLAYERS + 1];
13401340
bool g_bFirstJump[MAXPLAYERS + 1];
1341-
int g_iLastJump[MAXPLAYERS + 1];
1341+
float g_iLastJump[MAXPLAYERS + 1];
13421342
int g_iTicksOnGround[MAXPLAYERS + 1];
13431343
bool g_bNewStage[MAXPLAYERS + 1];
13441344
bool g_bLeftZone[MAXPLAYERS + 1];

addons/sourcemod/scripting/surftimer/hooks.sp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,27 +1336,28 @@ public Action Event_PlayerJump(Handle event, char[] name, bool dontBroadcast)
13361336
if (!g_bInStartZone[client] && !g_bInStageZone[client])
13371337
return Plugin_Continue;
13381338

1339+
// This logic for detecting bhops is pretty terrible and should be reworked -sneaK
13391340
g_iTicksOnGround[client] = 0;
1340-
int time = GetTime();
1341-
int cTime = time - g_iLastJump[client];
1341+
float time = GetGameTime();
1342+
float cTime = time - g_iLastJump[client];
13421343
if (!g_bInBhop[client])
13431344
{
13441345
if (g_bFirstJump[client])
13451346
{
1346-
if (cTime > 1)
1347+
if (cTime > 0.8)
13471348
{
1348-
g_bFirstJump[client] = false;
1349-
g_iLastJump[client] = GetTime();
1349+
g_bFirstJump[client] = true;
1350+
g_iLastJump[client] = GetGameTime();
13501351
}
13511352
else
13521353
{
1353-
g_iLastJump[client] = GetTime();
1354+
g_iLastJump[client] = GetGameTime();
13541355
g_bInBhop[client] = true;
13551356
}
13561357
}
13571358
else
13581359
{
1359-
g_iLastJump[client] = GetTime();
1360+
g_iLastJump[client] = GetGameTime();
13601361
g_bFirstJump[client] = true;
13611362
}
13621363
}
@@ -1365,11 +1366,11 @@ public Action Event_PlayerJump(Handle event, char[] name, bool dontBroadcast)
13651366
if (cTime > 1)
13661367
{
13671368
g_bInBhop[client] = false;
1368-
g_iLastJump[client] = GetTime();
1369+
g_iLastJump[client] = GetGameTime();
13691370
}
13701371
else
13711372
{
1372-
g_iLastJump[client] = GetTime();
1373+
g_iLastJump[client] = GetGameTime();
13731374
}
13741375
}
13751376
}

0 commit comments

Comments
 (0)