FailNadeFriday -> SpecialFriday

This commit is contained in:
BotoX 2018-08-20 16:37:07 +02:00
parent 1018ffa565
commit 64f4f98a8a

View File

@ -6,12 +6,11 @@
#pragma newdecls required
char g_sBlacklistedMapsPath[PLATFORM_MAX_PATH];
char g_sExtraMapsPath[PLATFORM_MAX_PATH];
public Plugin myinfo =
{
name = "Failnade Fridays",
name = "Special Friday",
author = "Obus",
description = "",
version = "",
@ -20,14 +19,10 @@ public Plugin myinfo =
public void OnPluginStart()
{
BuildPath(Path_SM, g_sBlacklistedMapsPath, sizeof(g_sBlacklistedMapsPath), "configs/failnadefridayblacklist.cfg");
BuildPath(Path_SM, g_sExtraMapsPath, sizeof(g_sExtraMapsPath), "configs/failnadefridayextra.cfg");
if (!FileExists(g_sBlacklistedMapsPath))
LogMessage("configs/failnadefridayblacklist.cfg missing, is this intended?");
BuildPath(Path_SM, g_sExtraMapsPath, sizeof(g_sExtraMapsPath), "configs/specialfriday.cfg");
if (!FileExists(g_sExtraMapsPath))
LogMessage("configs/failnadefridayextra.cfg missing, is this intended?");
LogMessage("configs/specialfriday.cfg missing, is this intended?");
}
public void OnClientPutInServer(int client)
@ -35,7 +30,7 @@ public void OnClientPutInServer(int client)
if (IsVoteInProgress())
return;
if (!IsItFailnadeTime())
if (!IsItFridayTime())
return;
MenuSource iOpenMenu = GetClientMenu(client);
@ -44,10 +39,10 @@ public void OnClientPutInServer(int client)
return;
Panel hNotifyPanel = new Panel(GetMenuStyleHandle(MenuStyle_Radio));
hNotifyPanel.SetTitle("*** It's Fail Nade Friday! ***");
hNotifyPanel.SetTitle("*** It's Extended Nomlist Friday! ***");
hNotifyPanel.DrawItem("", ITEMDRAW_SPACER);
hNotifyPanel.DrawItem("** Nades have a much higher knockback than usual for today. **", ITEMDRAW_RAWLINE);
hNotifyPanel.DrawItem("** In addition to that, extra maps have been added to rotation for today! **", ITEMDRAW_RAWLINE);
hNotifyPanel.DrawItem("** Extra maps have been added to the rotation for today. **", ITEMDRAW_RAWLINE);
hNotifyPanel.DrawItem("** Type !nominate to nominate them! **", ITEMDRAW_RAWLINE);
hNotifyPanel.DrawItem("", ITEMDRAW_SPACER);
hNotifyPanel.DrawItem("** Have fun! **", ITEMDRAW_RAWLINE);
hNotifyPanel.DrawItem("", ITEMDRAW_SPACER);
@ -75,10 +70,10 @@ public void OnConfigsExecuted()
public Action Timer_PostOnConfigsExecuted(Handle hThis)
{
if (!FileExists(g_sBlacklistedMapsPath))
SetFailState("configs/failnadefriday.cfg missing!");
if (!FileExists(g_sExtraMapsPath))
SetFailState("configs/specialfriday.cfg missing!");
if (IsItFailnadeTime())
if (IsItFridayTime())
{
ArrayList hExtraMaps = new ArrayList(ByteCountToCells(PLATFORM_MAX_PATH));
File hExtraMapsConfig = OpenFile(g_sExtraMapsPath, "r");
@ -113,40 +108,6 @@ public Action Timer_PostOnConfigsExecuted(Handle hThis)
delete hExtraMapsConfig;
delete hExtraMaps;
char sMap[64];
GetCurrentMap(sMap, sizeof(sMap));
File hBlacklistedMapsConfig = OpenFile(g_sBlacklistedMapsPath, "r");
while (!hBlacklistedMapsConfig.EndOfFile())
{
char sLine[128];
if (!hBlacklistedMapsConfig.ReadLine(sLine, sizeof(sLine)))
break;
if (strncmp(sLine, "//", 2) == 0)
continue;
int iCurIndex=0;
while (sLine[iCurIndex] != '\0')
{
if (sLine[iCurIndex] < 0x20 || sLine[iCurIndex] > 0x7F) sLine[iCurIndex] = '\0';
iCurIndex++;
}
sLine[iCurIndex-1]='\0';
if (strcmp(sLine, sMap, false) == 0)
{
delete hBlacklistedMapsConfig;
return;
}
}
delete hBlacklistedMapsConfig;
CreateTimer(3.0, Timer_LoadConfig, _, TIMER_FLAG_NO_MAPCHANGE);
}
}
@ -164,10 +125,10 @@ int SortFuncADTArray_SortAlphabetical(int idx1, int idx2, Handle hExtraMaps, Han
public Action Timer_LoadConfig(Handle hThis)
{
ServerCommand("exec failnadefriday");//2lazy
ServerCommand("exec specialfriday");
}
stock bool IsItFailnadeTime()
stock bool IsItFridayTime()
{
int iTime = GetTime();
int iHour;