From 9ed37c2bcf8b159f158d11104efb550bfac49a54 Mon Sep 17 00:00:00 2001 From: jenz Date: Sun, 18 Oct 2026 22:32:39 +0200 Subject: [PATCH] reworking for a third or fourth time the special map case to work for mako race mode. special zones got special names. when not special stage on special map do normal zones work. when special stage on special map are the normal zones disabled --- .../include/unloze_racetimer_specialmaps.inc | 26 ++++++++--------- .../scripting/unloze_racetimer_specialmaps.sp | 21 +++++++------- .../scripting/unloze_racetimer_2026.sp | 28 ++++++++++++++++--- 3 files changed, 46 insertions(+), 29 deletions(-) diff --git a/RaceTimer/scripting/include/unloze_racetimer_specialmaps.inc b/RaceTimer/scripting/include/unloze_racetimer_specialmaps.inc index f551be0..ad8c390 100644 --- a/RaceTimer/scripting/include/unloze_racetimer_specialmaps.inc +++ b/RaceTimer/scripting/include/unloze_racetimer_specialmaps.inc @@ -1,15 +1,11 @@ -#if defined _unloze_racetimer_specialmaps_included_ - #endinput -#endif -#define _unloze_racetimer_specialmaps_included_ - -/** - * Called on Every Round start to identify if special roundzones exist - * @char resultStart returns name of special startzone - * @char resultEnd returns name of special endzone - */ -forward void CheckIfSpecialRoundZones(char[] resultstart, char[] resultend); -/** -* @returns true if mako currently -*/ -native bool unloze_gBSpecialMapDisplay(); \ No newline at end of file +#if defined _unloze_racetimer_specialmaps_included_ + #endinput +#endif +#define _unloze_racetimer_specialmaps_included_ + +/** + * Called on Every Round start to identify if special roundzones exist + * @char resultStart returns name of special startzone + * @char resultEnd returns name of special endzone + */ +forward void CheckIfSpecialRoundZones(char[] resultstart, char[] resultend); diff --git a/RaceTimer/scripting/unloze_racetimer_specialmaps.sp b/RaceTimer/scripting/unloze_racetimer_specialmaps.sp index 0dd5650..15e39ad 100644 --- a/RaceTimer/scripting/unloze_racetimer_specialmaps.sp +++ b/RaceTimer/scripting/unloze_racetimer_specialmaps.sp @@ -9,7 +9,8 @@ #include #pragma newdecls required static Handle g_hSpecialRoundCheck; -char g_cMapname[g_dIndex]; +bool g_bCurrentMapSpecialMako; + public Plugin myinfo = { name = "unloze racetimer specialmaps", @@ -24,17 +25,16 @@ public Plugin myinfo = public APLRes AskPluginLoad2(Handle myself, bool late, char [] error, int err_max) { g_hSpecialRoundCheck = CreateGlobalForward("CheckIfSpecialRoundZones", ET_Ignore, Param_String, Param_String); - CreateNative("unloze_gBSpecialMapDisplay", Native_Isspecialmap); return APLRes_Success; } -//---------------------------------------------------------------------------------------------------- -// Purpose: -//---------------------------------------------------------------------------------------------------- -public int Native_Isspecialmap(Handle handler, int numParams) + +public void OnMapStart() { - GetCurrentMap(g_cMapname, sizeof(g_cMapname)); - return view_as(StrEqual(g_cMapname, "ze_FFVII_Mako_Reactor_v5_3", false)); + char Mapname[256]; + GetCurrentMap(Mapname, sizeof(Mapname)); + g_bCurrentMapSpecialMako = view_as(StrEqual(Mapname, "ze_FFVII_Mako_Reactor_v5_3", false)); } + //---------------------------------------------------------------------------------------------------- // Purpose: http://git.unloze.com/UNLOZE/sm-plugins/src/master/MakoVote/scripting/MakoVote.sp //---------------------------------------------------------------------------------------------------- @@ -100,8 +100,7 @@ public void OnPluginStart() //---------------------------------------------------------------------------------------------------- public Action Timer_CheckStage(Handle timer, any userid) { - GetCurrentMap(g_cMapname, sizeof(g_cMapname)); - if (StrEqual(g_cMapname, "ze_FFVII_Mako_Reactor_v5_3", false)) + if (g_bCurrentMapSpecialMako) { // == 11 means its racemode on mako if (GetCurrentStage() == 11) @@ -112,6 +111,7 @@ public Action Timer_CheckStage(Handle timer, any userid) //ZONE_PREFIX_MAKO_START_1 //ZONE_PREFIX_MAKO_RACE_2 Call_StartForward(g_hSpecialRoundCheck); + while (i < l_iZoneCount) { ZoneNameBasedOnIndex(i, l_cIndexName[i]); @@ -124,6 +124,7 @@ public Action Timer_CheckStage(Handle timer, any userid) Call_Finish(); } } + return Plugin_Handled; } //---------------------------------------------------------------------------------------------------- // Purpose: diff --git a/RaceTimer_2026/scripting/unloze_racetimer_2026.sp b/RaceTimer_2026/scripting/unloze_racetimer_2026.sp index 332ebb6..e755c55 100755 --- a/RaceTimer_2026/scripting/unloze_racetimer_2026.sp +++ b/RaceTimer_2026/scripting/unloze_racetimer_2026.sp @@ -277,6 +277,7 @@ public void OnMapStart() GetCurrentMap(g_cMapname, sizeof(g_cMapname)); Format(g_cSpecialMapStart, sizeof(g_cSpecialMapStart), ""); + Format(g_cSpecialMapEnd, sizeof(g_cSpecialMapEnd), ""); g_hCurrentMapClientRecords.Clear(); g_hCurrentMapAllTopRecords.Clear(); @@ -693,9 +694,20 @@ public void unloze_zoneEntry(int client, char[] zone) return; } int zoneIndex = RetrieveZoneIndex(zone); - int race_zone_count = GetTotalRaceZones(); - if (!(StrEqual(zone, g_cSpecialMapEnd)) && !race_zone_count) + + //no race zones. Its also not a special round on a map (mako race mode) where the only zones have unusual names (like MAKO_RACE) + if (!GetTotalRaceZones() && strlen(g_cSpecialMapStart) == 0) + { return; + } + if (!StrEqual(zone, g_cSpecialMapEnd) && !GetTotalRaceZones()) + return; + + //it is a race mode on a special map, so disable the normal racezones. + if (strlen(g_cSpecialMapStart) != 0 && !StrEqual(zone, g_cSpecialMapEnd)) + { + return; + } int l_iZoneCount = unloze_zoneCount(); @@ -728,14 +740,22 @@ public void unloze_zoneLeave(int client, char[] zone) { return; } - int race_zone_count = GetTotalRaceZones(); - if (!(StrEqual(zone, g_cSpecialMapStart)) && !race_zone_count) + + //no race zones. Its also not a special round on a map (mako race mode) where the only zones have unusual names (like MAKO_RACE) + if (!GetTotalRaceZones() && strlen(g_cSpecialMapStart) == 0) + { + return; + } + + //it is right now a special map that is doing a special round so we disable the normal race timers from running + if (strlen(g_cSpecialMapStart) != 0 && !StrEqual(zone, g_cSpecialMapStart)) { return; } if (GetClientTeam(client) == CS_TEAM_CT) { + //a normal zone or the special map condition for race zone on one stage of a map if ((StrContains(zone, "ZONE_PREFIX_START") > -1) || StrEqual(zone, g_cSpecialMapStart)) { if (!PM_IsPlayerSteam(client))