Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #127 from J-Tanzanite/J-Tanzanite-patch-1
Browse files Browse the repository at this point in the history
Add files via upload
  • Loading branch information
J-Tanzanite authored Jul 20, 2022
2 parents 90b95bb + 9fae12b commit 1e15895
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 106 deletions.
Binary file modified plugins/lilac.smx
Binary file not shown.
5 changes: 3 additions & 2 deletions scripting/lilac.sp
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,15 @@ public void OnPluginStart()
if (tick_rate > 50) {
bhop_settings_min[BHOP_INDEX_MIN] = 5;
bhop_settings_min[BHOP_INDEX_MAX] = 10;
bhop_settings_min[BHOP_INDEX_TOTAL] = 2;
bhop_settings_min[BHOP_INDEX_TOTAL] = 1;
}
else {
bhop_settings_min[BHOP_INDEX_MIN] = 10;
bhop_settings_min[BHOP_INDEX_MAX] = 20;
bhop_settings_min[BHOP_INDEX_TOTAL] = 4;
bhop_settings_min[BHOP_INDEX_TOTAL] = 3;
}
bhop_settings_min[BHOP_INDEX_JUMP] = -1;
bhop_settings_min[BHOP_INDEX_AIR] = 0;

/* This sets up convars and such. */
lilac_config_setup();
Expand Down
29 changes: 16 additions & 13 deletions scripting/lilac/lilac_bhop.sp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

static int jump_ticks[MAXPLAYERS + 1];
static int perfect_bhops[MAXPLAYERS + 1];
static int next_bhop[MAXPLAYERS + 1];
static int detections[MAXPLAYERS + 1];


Expand All @@ -26,6 +27,7 @@ static void bhop_reset(int client)
/* -1 because the initial jump doesn't count. */
jump_ticks[client] = -1;
perfect_bhops[client] = -1;
next_bhop[client] = GetGameTickCount();
}

void lilac_bhop_reset_client(int client)
Expand All @@ -46,8 +48,14 @@ void lilac_bhop_check(int client, const int buttons, int last_buttons)
int flags = GetEntityFlags(client);
if ((buttons & IN_JUMP) && !(last_buttons & IN_JUMP)) {
if ((flags & FL_ONGROUND)) {
perfect_bhops[client]++;
check_bhop_max(client);
if (GetGameTickCount() > next_bhop[client]) {
next_bhop[client] = GetGameTickCount() + bhop_settings[BHOP_INDEX_AIR];
perfect_bhops[client]++;
check_bhop_max(client);
}
else {
bhop_reset(client);
}
}
}
else if ((flags & FL_ONGROUND)) {
Expand All @@ -56,11 +64,6 @@ void lilac_bhop_check(int client, const int buttons, int last_buttons)
}
}

static bool forward_allow_detection(int client)
{
return (lilac_forward_allow_cheat_detection(client, CHEAT_BHOP) == true);
}

static void check_bhop_max(int client)
{
/* Invalid max, disable max bhop bans. */
Expand All @@ -70,11 +73,11 @@ static void check_bhop_max(int client)
if (perfect_bhops[client] < bhop_settings[BHOP_INDEX_MAX])
return;

if (forward_allow_detection(client) == false)
if (lilac_forward_allow_cheat_detection(client, CHEAT_BHOP) == false)
return;

/* Client just hit the max threshhold, insta ban. */
lilac_detected_bhop(client);
lilac_detected_bhop(client, true);
lilac_ban_bhop(client);
}

Expand All @@ -93,21 +96,21 @@ static void check_bhop_min(int client)
+ bhop_settings[BHOP_INDEX_MIN])
return;

if (forward_allow_detection(client) == false)
if (lilac_forward_allow_cheat_detection(client, CHEAT_BHOP) == false)
return;

lilac_detected_bhop(client);
lilac_detected_bhop(client, false);
}

static void lilac_detected_bhop(int client)
static void lilac_detected_bhop(int client, bool force_log)
{
lilac_forward_client_cheat(client, CHEAT_BHOP);

/* Detection expires in 10 minutes. */
CreateTimer(600.0, timer_decrement_bhop, GetClientUserId(client));

/* Don't log the first detection. */
if (++detections[client] < 2)
if (++detections[client] < 2 && force_log == false)
return;

if (icvar[CVAR_LOG]) {
Expand Down
Loading

0 comments on commit 1e15895

Please sign in to comment.