updated so mako has its racezone back on racemode

This commit is contained in:
jenz 2022-08-09 15:54:34 +02:00
parent c8ebb1554c
commit 788e98a29d
2 changed files with 63 additions and 66 deletions

View File

@ -74,6 +74,7 @@ public void OnPluginStart()
continue; continue;
OnClientCookiesCached(i); OnClientCookiesCached(i);
} }
g_bDisplaySpecial = unloze_gBSpecialMapDisplay();
} }
public void trigger_teleport(const char[] output, int entity_index, int client, float delay) public void trigger_teleport(const char[] output, int entity_index, int client, float delay)
@ -214,23 +215,25 @@ public void SQL_FinishedQuery(Database db, DBResultSet results, const char[] err
public void OnMapStart() public void OnMapStart()
{ {
if (!g_dDatabase) if (!g_dDatabase)
Database.Connect(SQL_OnDatabaseConnect, "racetimercss"); Database.Connect(SQL_OnDatabaseConnect, "racetimercss");
else else
{ {
static Handle hHostName; static Handle hHostName;
if((hHostName = FindConVar("hostname")) == INVALID_HANDLE) if((hHostName = FindConVar("hostname")) == INVALID_HANDLE)
return; return;
char line[g_dLength]; char line[g_dLength];
GetConVarString(hHostName, line, sizeof(line)); GetConVarString(hHostName, line, sizeof(line));
if (StrContains(line, "EVENT", false) > -1) if (StrContains(line, "EVENT", false) > -1)
g_bEventBool = true; g_bEventBool = true;
else else
g_bEventBool = false; g_bEventBool = false;
g_bDisplaySpecial = unloze_gBSpecialMapDisplay(); g_bDisplaySpecial = unloze_gBSpecialMapDisplay();
GetCurrentMap(g_cMapname, sizeof(g_cMapname)); GetCurrentMap(g_cMapname, sizeof(g_cMapname));
startTimer(); startTimer();
} }
Format(g_cSpecialMapStart, sizeof(g_cSpecialMapStart), "");
Format(g_cSpecialMapEnd, sizeof(g_cSpecialMapEnd), "");
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
@ -267,6 +270,8 @@ public void startTimer()
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast) public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast)
{ {
Format(g_cSpecialMapStart, sizeof(g_cSpecialMapStart), "");
Format(g_cSpecialMapEnd, sizeof(g_cSpecialMapEnd), "");
int race_zone_count = GetTotalRaceZones(); int race_zone_count = GetTotalRaceZones();
if (!race_zone_count) if (!race_zone_count)
return; return;
@ -478,11 +483,11 @@ public void unloze_zoneEntry(int client, char[] zone)
{ {
int zoneIndex = RetrieveZoneIndex(zone); int zoneIndex = RetrieveZoneIndex(zone);
int race_zone_count = GetTotalRaceZones(); int race_zone_count = GetTotalRaceZones();
if (!race_zone_count) if (!(StrEqual(zone, g_cSpecialMapEnd)) && !race_zone_count)
return; return;
int l_iZoneCount = unloze_zoneCount(); int l_iZoneCount = unloze_zoneCount();
if (GetClientTeam(client) == CS_TEAM_CT && g_bHumansAllowedTime[client]) if (GetClientTeam(client) == CS_TEAM_CT && (g_bHumansAllowedTime[client] || StrEqual(zone, g_cSpecialMapEnd)))
{ {
if ((StrContains(zone, "ZONE_PREFIX_RACE") > -1) || StrEqual(zone, g_cSpecialMapEnd)) if ((StrContains(zone, "ZONE_PREFIX_RACE") > -1) || StrEqual(zone, g_cSpecialMapEnd))
{ {
@ -523,7 +528,8 @@ public void unloze_zoneLeave(int client, char[] zone)
{ {
//only maps with multiple zones need ZONE_PREFIX_START //only maps with multiple zones need ZONE_PREFIX_START
int race_zone_count = GetTotalRaceZones(); int race_zone_count = GetTotalRaceZones();
if (!race_zone_count || g_bAllowToLeave[client]) //if zone has special name like in mako dont return despite g_bAllowToLeave being false or there being no normally named zone
if (!(StrEqual(zone, g_cSpecialMapStart)) && (!race_zone_count || g_bAllowToLeave[client]))
return; return;
if (GetClientTeam(client) == CS_TEAM_CT) if (GetClientTeam(client) == CS_TEAM_CT)
@ -560,8 +566,8 @@ public void unloze_zoneCreated()
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public void CheckIfSpecialRoundZones(char[] resultstart, char[] resultend) public void CheckIfSpecialRoundZones(char[] resultstart, char[] resultend)
{ {
Format(g_cSpecialMapStart, sizeof(g_cSpecialMapStart), resultstart); Format(g_cSpecialMapStart, sizeof(g_cSpecialMapStart), resultstart);
Format(g_cSpecialMapEnd, sizeof(g_cSpecialMapEnd), resultend); Format(g_cSpecialMapEnd, sizeof(g_cSpecialMapEnd), resultend);
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:

View File

@ -9,7 +9,7 @@
#include <unloze_zones> #include <unloze_zones>
#pragma newdecls required #pragma newdecls required
static Handle g_hSpecialRoundCheck; static Handle g_hSpecialRoundCheck;
bool g_bSpecialMap; Handle g_hTimer_check_stage = null;
bool g_bCheckedRound; bool g_bCheckedRound;
char g_cMapname[g_dIndex]; char g_cMapname[g_dIndex];
public Plugin myinfo = public Plugin myinfo =
@ -34,23 +34,15 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char [] error, int err_ma
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public int Native_Isspecialmap(Handle handler, int numParams) public int Native_Isspecialmap(Handle handler, int numParams)
{ {
CreateTimer(10.0, Timer_CheckStage, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); GetCurrentMap(g_cMapname, sizeof(g_cMapname));
GetCurrentMap(g_cMapname, sizeof(g_cMapname)); return view_as<bool>(StrEqual(g_cMapname, "ze_FFVII_Mako_Reactor_v5_3", false));
if (StrEqual(g_cMapname, "ze_FFVII_Mako_Reactor_v5_3", false))
{
g_bSpecialMap = true;
return view_as<bool>(1);
}
else
g_bSpecialMap = false;
return view_as<bool>(0);
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: http://git.unloze.com/UNLOZE/sm-plugins/src/master/MakoVote/scripting/MakoVote.sp // Purpose: http://git.unloze.com/UNLOZE/sm-plugins/src/master/MakoVote/scripting/MakoVote.sp
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public int GetCurrentStage() public int GetCurrentStage()
{ {
int iLevelCounterEnt = FindEntityByTargetname(INVALID_ENT_REFERENCE, "Level_Counter", "math_counter"); int iLevelCounterEnt = FindEntityByTargetname(INVALID_ENT_REFERENCE, "LevelCounter", "math_counter");
if (iLevelCounterEnt == -1) if (iLevelCounterEnt == -1)
return 0; return 0;
int offset = FindDataMapInfo(iLevelCounterEnt, "m_OutValue"); int offset = FindDataMapInfo(iLevelCounterEnt, "m_OutValue");
@ -93,49 +85,48 @@ public int FindEntityByTargetname(int entity, const char[] sTargetname, const ch
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public void OnPluginEnd() public void OnPluginEnd()
{ {
CloseHandle(g_hSpecialRoundCheck); if (g_hSpecialRoundCheck != null)
delete g_hSpecialRoundCheck;
if (g_hTimer_check_stage != null)
delete g_hTimer_check_stage;
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public void OnPluginStart() public void OnPluginStart()
{ {
//hooks g_hTimer_check_stage = CreateTimer(10.0, Timer_CheckStage, _, TIMER_REPEAT);
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
//hooks
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose:
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
public Action Timer_CheckStage(Handle timer, any userid) public Action Timer_CheckStage(Handle timer, any userid)
{ {
if (g_bCheckedRound) GetCurrentMap(g_cMapname, sizeof(g_cMapname));
{ if (StrEqual(g_cMapname, "ze_FFVII_Mako_Reactor_v5_3", false) && g_bCheckedRound)
g_bCheckedRound = false; {
if (!g_bSpecialMap || GetCurrentStage() != 11) g_bCheckedRound = false;
{ // == 11 means its racemode on mako
Call_StartForward(g_hSpecialRoundCheck); if (GetCurrentStage() == 11)
Call_PushString(""); {
Call_PushString(""); int l_iZoneCount = unloze_zoneCount();
Call_Finish(); char l_cIndexName[g_dIndex][g_dLength];
return; int i;
} //ZONE_PREFIX_MAKO_START_1
int l_iZoneCount = unloze_zoneCount(); //ZONE_PREFIX_MAKO_RACE_2
char l_cIndexName[g_dIndex][g_dLength]; Call_StartForward(g_hSpecialRoundCheck);
int i; while (i < l_iZoneCount)
Call_StartForward(g_hSpecialRoundCheck); {
while (i < l_iZoneCount) ZoneNameBasedOnIndex(i, l_cIndexName[i]);
{ Call_PushString(l_cIndexName[i]);
ZoneNameBasedOnIndex(i, l_cIndexName[i]); i++;
if (StrContains(l_cIndexName[i], "ZZ") > -1) }
{ Call_Finish();
Call_PushString(l_cIndexName[i +1]); }
} }
else
Call_PushString(l_cIndexName[i]);
i++;
}
Call_Finish();
}
} }
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// Purpose: // Purpose: