#pragma semicolon 1 #define DEBUG #define PLUGIN_AUTHOR "jenz" #define PLUGIN_VERSION "1.00" #define g_dLength 256 #define g_dIndex 64 #include #include #include #pragma newdecls required static Handle g_hSpecialRoundCheck; bool g_bCurrentMapSpecialMako; public Plugin myinfo = { name = "unloze racetimer specialmaps", author = PLUGIN_AUTHOR, description = "intended for adding racemaps based on levels and whatnot", version = PLUGIN_VERSION, url = "www.unloze.com" }; //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public APLRes AskPluginLoad2(Handle myself, bool late, char [] error, int err_max) { g_hSpecialRoundCheck = CreateGlobalForward("CheckIfSpecialRoundZones", ET_Ignore, Param_String, Param_String); return APLRes_Success; } public void OnMapStart() { 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 //---------------------------------------------------------------------------------------------------- public int GetCurrentStage() { int iLevelCounterEnt = FindEntityByTargetname(INVALID_ENT_REFERENCE, "LevelCounter", "info_target"); if (iLevelCounterEnt == -1) return 0; int offset = FindDataMapInfo(iLevelCounterEnt, "m_OutValue"); int iCounterVal = RoundFloat(GetEntDataFloat(iLevelCounterEnt, offset)); return iCounterVal; } //---------------------------------------------------------------------------------------------------- // Purpose: http://git.unloze.com/UNLOZE/sm-plugins/src/master/MakoVote/scripting/MakoVote.sp //---------------------------------------------------------------------------------------------------- public int FindEntityByTargetname(int entity, const char[] sTargetname, const char[] sClassname) { if (sTargetname[0] == '#') // HammerID { int HammerID = StringToInt(sTargetname[1]); while((entity = FindEntityByClassname(entity, sClassname)) != INVALID_ENT_REFERENCE) { if(GetEntProp(entity, Prop_Data, "m_iHammerID") == HammerID) return entity; } } else // Targetname { int Wildcard = FindCharInString(sTargetname, '*'); char sTargetnameBuf[g_dIndex]; while((entity = FindEntityByClassname(entity, sClassname)) != INVALID_ENT_REFERENCE) { if(GetEntPropString(entity, Prop_Data, "m_iName", sTargetnameBuf, sizeof(sTargetnameBuf)) <= 0) continue; if(strncmp(sTargetnameBuf, sTargetname, Wildcard) == 0) return entity; } } return INVALID_ENT_REFERENCE; } //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public void OnPluginEnd() { if (g_hSpecialRoundCheck != null) delete g_hSpecialRoundCheck; } //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public void OnPluginStart() { //hooks HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy); } //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public Action Timer_CheckStage(Handle timer, any userid) { if (g_bCurrentMapSpecialMako) { // == 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]); if (StrContains(l_cIndexName[i], "MAKO", false) != -1) { Call_PushString(l_cIndexName[i]); } i++; } Call_Finish(); } } return Plugin_Handled; } //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast) { CreateTimer(5.0, Timer_CheckStage, _); }