Update NextMap, Nominations, RandomCycle, and RockTheVote with newer MethodMap stuff

This commit is contained in:
Ross Bemrose
2014-12-16 14:16:06 -05:00
parent bc4d6b7104
commit 1b79252947
4 changed files with 86 additions and 82 deletions
+17 -16
View File
@@ -47,7 +47,7 @@ public Plugin myinfo =
};
int g_MapPos = -1;
Handle g_MapList = null;
ArrayList g_MapList = null;
int g_MapListSerial = -1;
int g_CurrentMapStartTime;
@@ -78,14 +78,15 @@ public void OnPluginStart()
LoadTranslations("common.phrases");
LoadTranslations("nextmap.phrases");
g_MapList = CreateArray(32);
int size = ByteCountToCells(PLATFORM_MAX_PATH);
g_MapList = new ArrayList(size);
RegAdminCmd("sm_maphistory", Command_MapHistory, ADMFLAG_CHANGEMAP, "Shows the most recent maps played");
RegConsoleCmd("listmaps", Command_List);
// Set to the current map so OnMapStart() will know what to do
char currentMap[64];
GetCurrentMap(currentMap, 64);
char currentMap[PLATFORM_MAX_PATH];
GetCurrentMap(currentMap, sizeof(currentMap));
SetNextMap(currentMap);
}
@@ -96,9 +97,9 @@ public void OnMapStart()
public void OnConfigsExecuted()
{
char lastMap[64], currentMap[64];
char lastMap[PLATFORM_MAX_PATH], currentMap[PLATFORM_MAX_PATH];
GetNextMap(lastMap, sizeof(lastMap));
GetCurrentMap(currentMap, 64);
GetCurrentMap(currentMap, sizeof(currentMap));
// Why am I doing this? If we switched to a new map, but it wasn't what we expected (Due to sm_map, sm_votemap, or
// some other plugin/command), we don't want to scramble the map cycle. Or for example, admin switches to a custom map
@@ -113,11 +114,11 @@ public Action Command_List(int client, int args)
{
PrintToConsole(client, "Map Cycle:");
int mapCount = GetArraySize(g_MapList);
char mapName[32];
int mapCount = g_MapList.Length;
char mapName[PLATFORM_MAX_PATH];
for (int i = 0; i < mapCount; i++)
{
GetArrayString(g_MapList, i, mapName, sizeof(mapName));
g_MapList.GetString(i, mapName, sizeof(mapName));
PrintToConsole(client, "%s", mapName);
}
@@ -139,17 +140,17 @@ void FindAndSetNextMap()
}
}
int mapCount = GetArraySize(g_MapList);
char mapName[32];
int mapCount = g_MapList.Length;
char mapName[PLATFORM_MAX_PATH];
if (g_MapPos == -1)
{
char current[64];
GetCurrentMap(current, 64);
char current[PLATFORM_MAX_PATH];
GetCurrentMap(current, sizeof(current));
for (int i = 0; i < mapCount; i++)
{
GetArrayString(g_MapList, i, mapName, sizeof(mapName));
g_MapList.GetString(i, mapName, sizeof(mapName));
if (strcmp(current, mapName, false) == 0)
{
g_MapPos = i;
@@ -165,7 +166,7 @@ void FindAndSetNextMap()
if (g_MapPos >= mapCount)
g_MapPos = 0;
GetArrayString(g_MapList, g_MapPos, mapName, sizeof(mapName));
g_MapList.GetString(g_MapPos, mapName, sizeof(mapName));
SetNextMap(mapName);
}
@@ -173,7 +174,7 @@ public Action Command_MapHistory(int client, int args)
{
int mapCount = GetMapHistorySize();
char mapName[32];
char mapName[PLATFORM_MAX_PATH];
char changeReason[100];
char timeString[100];
char playedTime[100];