1.1 --- a/plugins/rockthevote.sp Fri Nov 09 18:08:09 2007 +0000
1.2 +++ b/plugins/rockthevote.sp Fri Nov 09 23:46:05 2007 +0000
1.3 @@ -71,8 +71,9 @@
1.4 LoadTranslations("common.phrases");
1.5 LoadTranslations("rockthevote.phrases");
1.6
1.7 - g_MapList = CreateArray(33);
1.8 - g_RTVMapList = CreateArray(33);
1.9 + new arraySize = ByteCountToCells(33);
1.10 + g_MapList = CreateArray(arraySize);
1.11 + g_RTVMapList = CreateArray(arraySize);
1.12
1.13 g_Cvar_Needed = CreateConVar("sm_rtv_needed", "0.60", "Percentage of players needed to rockthevote (Def 60%)", 0, true, 0.05, true, 1.0);
1.14 g_Cvar_File = CreateConVar("sm_rtv_file", "configs/maps.ini", "Map file to use. (Def configs/maps.ini)");
1.15 @@ -161,23 +162,18 @@
1.16 decl String:mapname[64];
1.17 GetCmdArg(1, mapname, sizeof(mapname));
1.18
1.19 - if (!IsStringInArray(g_MapList, mapname))
1.20 + if (FindStringInArray(g_MapList, mapname) == -1)
1.21 {
1.22 ReplyToCommand(client, "%t", "Map was not found", mapname);
1.23 return Plugin_Handled;
1.24 }
1.25
1.26 if (GetArraySize(g_RTVMapList) > 0)
1.27 - {
1.28 - for (new i = 0; i < GetArraySize(g_RTVMapList); i++)
1.29 - {
1.30 - decl String:nextmap[64];
1.31 - GetArrayString(g_RTVMapList, i, nextmap, sizeof(nextmap));
1.32 - if (strcmp(mapname, nextmap, false) == 0)
1.33 - {
1.34 - ReplyToCommand(client, "%t", "Map Already In Vote", mapname);
1.35 - return Plugin_Handled;
1.36 - }
1.37 + {
1.38 + if (FindStringInArray(g_RTVMapList, mapname) != -1)
1.39 + {
1.40 + ReplyToCommand(client, "%t", "Map Already In Vote", mapname);
1.41 + return Plugin_Handled;
1.42 }
1.43
1.44 ShiftArrayUp(g_RTVMapList, 0);
1.45 @@ -336,13 +332,8 @@
1.46 new Handle:MapVoteMenu = CreateMenu(Handler_MapMapVoteMenu, MenuAction:MENU_ACTIONS_ALL);
1.47 SetMenuTitle(MapVoteMenu, "Rock The Vote");
1.48
1.49 - new Handle:tempMaps = CreateArray(33);
1.50 + new Handle:tempMaps = CloneArray(g_MapList);
1.51 decl String:map[32];
1.52 - for (new i = 0; i < GetArraySize(g_MapList); i++)
1.53 - {
1.54 - GetArrayString(g_MapList, i, map, sizeof(map));
1.55 - PushArrayString(tempMaps, map);
1.56 - }
1.57
1.58 // We assume that g_RTVMapList is within the correct limits, based on the logic for nominations
1.59 for (new i = 0; i < GetArraySize(g_RTVMapList); i++)
1.60 @@ -350,15 +341,10 @@
1.61 GetArrayString(g_RTVMapList, i, map, sizeof(map));
1.62 AddMenuItem(MapVoteMenu, map, map);
1.63
1.64 - for (new j = 0; j < GetArraySize(tempMaps); j++)
1.65 + new index = FindStringInArray(tempMaps, map);
1.66 + if (index != -1)
1.67 {
1.68 - decl String:temp[32];
1.69 - GetArrayString(tempMaps, j, temp, sizeof(temp));
1.70 - if (strcmp(map, temp) == 0)
1.71 - {
1.72 - RemoveFromArray(tempMaps, j);
1.73 - break;
1.74 - }
1.75 + RemoveFromArray(tempMaps, index);
1.76 }
1.77 }
1.78
1.79 @@ -489,7 +475,7 @@
1.80 decl String:map[64], String:name[64];
1.81 GetMenuItem(menu, param2, map, sizeof(map));
1.82
1.83 - if (IsStringInArray(g_RTVMapList, map))
1.84 + if (FindStringInArray(g_RTVMapList, map) != -1)
1.85 {
1.86 PrintToChat(param1, "[SM] %t", "Map Already Nominated");
1.87 return;