updated so mako has its racezone back on racemode

This commit is contained in:
jenz
2022-08-09 15:54:34 +02:00
parent bd82e3947f
commit 30145198f4
2 changed files with 63 additions and 66 deletions
@@ -9,7 +9,7 @@
#include <unloze_zones>
#pragma newdecls required
static Handle g_hSpecialRoundCheck;
bool g_bSpecialMap;
Handle g_hTimer_check_stage = null;
bool g_bCheckedRound;
char g_cMapname[g_dIndex];
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)
{
CreateTimer(10.0, Timer_CheckStage, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
GetCurrentMap(g_cMapname, sizeof(g_cMapname));
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);
GetCurrentMap(g_cMapname, sizeof(g_cMapname));
return view_as<bool>(StrEqual(g_cMapname, "ze_FFVII_Mako_Reactor_v5_3", false));
}
//----------------------------------------------------------------------------------------------------
// Purpose: http://git.unloze.com/UNLOZE/sm-plugins/src/master/MakoVote/scripting/MakoVote.sp
//----------------------------------------------------------------------------------------------------
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)
return 0;
int offset = FindDataMapInfo(iLevelCounterEnt, "m_OutValue");
@@ -93,49 +85,48 @@ public int FindEntityByTargetname(int entity, const char[] sTargetname, const ch
//----------------------------------------------------------------------------------------------------
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:
//----------------------------------------------------------------------------------------------------
public void OnPluginStart()
{
//hooks
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
g_hTimer_check_stage = CreateTimer(10.0, Timer_CheckStage, _, TIMER_REPEAT);
//hooks
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action Timer_CheckStage(Handle timer, any userid)
{
if (g_bCheckedRound)
{
g_bCheckedRound = false;
if (!g_bSpecialMap || GetCurrentStage() != 11)
{
Call_StartForward(g_hSpecialRoundCheck);
Call_PushString("");
Call_PushString("");
Call_Finish();
return;
}
int l_iZoneCount = unloze_zoneCount();
char l_cIndexName[g_dIndex][g_dLength];
int i;
Call_StartForward(g_hSpecialRoundCheck);
while (i < l_iZoneCount)
{
ZoneNameBasedOnIndex(i, l_cIndexName[i]);
if (StrContains(l_cIndexName[i], "ZZ") > -1)
{
Call_PushString(l_cIndexName[i +1]);
}
else
Call_PushString(l_cIndexName[i]);
i++;
}
Call_Finish();
}
GetCurrentMap(g_cMapname, sizeof(g_cMapname));
if (StrEqual(g_cMapname, "ze_FFVII_Mako_Reactor_v5_3", false) && g_bCheckedRound)
{
g_bCheckedRound = false;
// == 11 means its racemode on mako
if (GetCurrentStage() == 11)
{
int l_iZoneCount = unloze_zoneCount();
char l_cIndexName[g_dIndex][g_dLength];
int i;
//ZONE_PREFIX_MAKO_START_1
//ZONE_PREFIX_MAKO_RACE_2
Call_StartForward(g_hSpecialRoundCheck);
while (i < l_iZoneCount)
{
ZoneNameBasedOnIndex(i, l_cIndexName[i]);
Call_PushString(l_cIndexName[i]);
i++;
}
Call_Finish();
}
}
}
//----------------------------------------------------------------------------------------------------
// Purpose:
@@ -143,4 +134,4 @@ public Action Timer_CheckStage(Handle timer, any userid)
public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast)
{
g_bCheckedRound = true;
}
}