Skip to content

Commit

Permalink
Added kz_enable_nub_bot (#42)
Browse files Browse the repository at this point in the history
* Added kz_enable_nub_bot cvar

---------

Co-authored-by: Xelson <xelson1337@gmail.com>
  • Loading branch information
Psycrow101 and Xelson committed Apr 6, 2023
1 parent 5f825da commit d9bf368
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions src/scripts/utility/kz_rush_pubbot.sma
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
#define VERSION "1.3"
#define AUTHOR "Kpoluk"

// comment this to disable recording for nub runs
// #define ENABLE_NUB_BOT

#define FLAG_GROUND (1 << 7)
#define FLAG_JUMP (1 << 6)
#define FLAG_DUCK (1 << 5)
Expand Down Expand Up @@ -62,6 +59,12 @@ new g_hFile[33];
new g_szNavName[33][128];
new g_hNavFile;

enum CvarsEnum {
cvarEnableNubBot,
};

new g_Cvars[CvarsEnum];


public plugin_precache()
{
Expand Down Expand Up @@ -119,6 +122,8 @@ public plugin_init()
retrieveName();
parseNav();

initCvars();

// register_saycmd("started", "fwPubStarted");
// register_saycmd("rejected", "fwPubRejected");
// register_saycmd("paused", "fwPubPaused");
Expand Down Expand Up @@ -146,16 +151,17 @@ public kz_top_new_pro_rec(id, Float:fTime) {
fwPubFinished(id, fTime, 0, 0);
}

#if defined ENABLE_NUB_BOT
public kz_top_new_nub_rec(id, Float:fTime, checkpointsCount, teleportsCount) {
if (!g_Cvars[cvarEnableNubBot])
return;

if (kz_has_map_pro_rec(AIR_ACCELERATE_10)) {
fwPubFinished(id, 0.0, 0, 0);
return;
}

fwPubFinished(id, fTime, checkpointsCount, teleportsCount);
}
#endif

public kz_timer_stop_post(id) {
fwPubRejected(id);
Expand All @@ -170,13 +176,13 @@ public kz_starttp_pre(id) {

public kz_tp_post(id) {
if (kz_get_timer_state(id) == TIMER_ENABLED) {
#if defined ENABLE_NUB_BOT
if (kz_has_map_pro_rec(AIR_ACCELERATE_10)) {
fwPubRejected(id);
if (g_Cvars[cvarEnableNubBot]) {
if (kz_has_map_pro_rec(AIR_ACCELERATE_10)) {
fwPubRejected(id);
}
}
#else
fwPubRejected(id);
#endif
else
fwPubRejected(id);
}

return KZ_CONTINUE;
Expand Down Expand Up @@ -960,6 +966,13 @@ public playbackSound(id)
return;
}

initCvars() {
// Enable recording for nub runs
// 0 - disabled (default)
// 1 - enabled
bind_pcvar_num(create_cvar("kz_enable_nub_bot", "0"), g_Cvars[cvarEnableNubBot]);
}

public plugin_end()
{
ArrayDestroy(g_aOrigins);
Expand Down

0 comments on commit d9bf368

Please sign in to comment.