1.1 --- a/plugins/rockthevote.sp Mon Jun 30 23:18:26 2008 +0000
1.2 +++ b/plugins/rockthevote.sp Tue Jul 01 01:18:52 2008 +0000
1.3 @@ -32,6 +32,8 @@
1.4 */
1.5
1.6 #include <sourcemod>
1.7 +#include <mapchooser>
1.8 +#include <nextmap>
1.9
1.10 #pragma semicolon 1
1.11
1.12 @@ -45,44 +47,37 @@
1.13 };
1.14
1.15 new Handle:g_Cvar_Needed = INVALID_HANDLE;
1.16 -new Handle:g_Cvar_Maps = INVALID_HANDLE;
1.17 -new Handle:g_Cvar_Nominate = INVALID_HANDLE;
1.18 new Handle:g_Cvar_MinPlayers = INVALID_HANDLE;
1.19 -
1.20 -new Handle:g_MapList = INVALID_HANDLE;
1.21 -new Handle:g_RTVMapList = INVALID_HANDLE;
1.22 -new Handle:g_MapMenu = INVALID_HANDLE;
1.23 -new Handle:g_RetryTimer = INVALID_HANDLE;
1.24 -new g_mapFileSerial = -1;
1.25 +new Handle:g_Cvar_InitialDelay = INVALID_HANDLE;
1.26 +new Handle:g_Cvar_Interval = INVALID_HANDLE;
1.27 +new Handle:g_Cvar_ChangeTime = INVALID_HANDLE;
1.28 +new Handle:g_Cvar_RTVPostVoteAction = INVALID_HANDLE;
1.29
1.30 new bool:g_CanRTV = false; // True if RTV loaded maps and is active.
1.31 new bool:g_RTVAllowed = false; // True if RTV is available to players. Used to delay rtv votes.
1.32 -new bool:g_RTVStarted = false; // Indicates that the actual map vote has started
1.33 -new bool:g_RTVEnded = false; // Indicates that the actual map vote has concluded
1.34 new g_Voters = 0; // Total voters connected. Doesn't include fake clients.
1.35 new g_Votes = 0; // Total number of "say rtv" votes
1.36 new g_VotesNeeded = 0; // Necessary votes before map vote begins. (voters * percent_needed)
1.37 new bool:g_Voted[MAXPLAYERS+1] = {false, ...};
1.38 -new bool:g_Nominated[MAXPLAYERS+1] = {false, ...};
1.39 +
1.40 +new bool:g_InChange = false;
1.41
1.42 public OnPluginStart()
1.43 {
1.44 LoadTranslations("common.phrases");
1.45 LoadTranslations("rockthevote.phrases");
1.46
1.47 - new arraySize = ByteCountToCells(33);
1.48 - g_MapList = CreateArray(arraySize);
1.49 - g_RTVMapList = CreateArray(arraySize);
1.50 -
1.51 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.52 - g_Cvar_Maps = CreateConVar("sm_rtv_maps", "4", "Number of maps to be voted on. 2 to 6. (Def 4)", 0, true, 2.0, true, 6.0);
1.53 - g_Cvar_Nominate = CreateConVar("sm_rtv_nominate", "1", "Enables nomination system.", 0, true, 0.0, true, 1.0);
1.54 g_Cvar_MinPlayers = CreateConVar("sm_rtv_minplayers", "0", "Number of players required before RTV will be enabled.", 0, true, 0.0, true, float(MAXPLAYERS));
1.55 + g_Cvar_InitialDelay = CreateConVar("sm_rtv_initialdelay", "30.0", "Time before first RTV can be held", 0, true, 0.00);
1.56 + g_Cvar_Interval = CreateConVar("sm_rtv_interval", "240.0", "Time after a failed RTV before another can be held", 0, true, 0.00);
1.57 + g_Cvar_ChangeTime = CreateConVar("sm_rtv_changetime", "0", "When to change the map after a succesful RTV: 0 - Instant, 1 - RoundEnd, 2 - MapEnd", _, true, 0.0, true, 2.0);
1.58 + g_Cvar_RTVPostVoteAction = CreateConVar("sm_rtv_postvoteaction", "0", "What to do with RTV's after a mapvote has completed. 0 - Allow, success = instant change, 1 - Deny", _, true, 0.0, true, 1.0);
1.59
1.60 RegConsoleCmd("say", Command_Say);
1.61 RegConsoleCmd("say_team", Command_Say);
1.62
1.63 - RegAdminCmd("sm_rtv_addmap", Command_Addmap, ADMFLAG_CHANGEMAP, "sm_rtv_addmap <mapname> - Forces a map to be on the RTV, and lowers the allowed nominations.");
1.64 + RegConsoleCmd("sm_rtv", Command_RTV);
1.65
1.66 AutoExecConfig(true, "rtv");
1.67 }
1.68 @@ -92,8 +87,17 @@
1.69 g_Voters = 0;
1.70 g_Votes = 0;
1.71 g_VotesNeeded = 0;
1.72 - g_RTVStarted = false;
1.73 - g_RTVEnded = false;
1.74 + g_InChange = false;
1.75 +
1.76 + /* Handle late load */
1.77 + new maxclients = GetMaxClients();
1.78 + for (new i=1; i<=maxclients; i++)
1.79 + {
1.80 + if (IsClientConnected(i))
1.81 + {
1.82 + OnClientConnect(i, "", 0);
1.83 + }
1.84 + }
1.85 }
1.86
1.87 public OnMapEnd()
1.88 @@ -103,36 +107,18 @@
1.89 }
1.90
1.91 public OnConfigsExecuted()
1.92 -{
1.93 - if (g_RTVMapList != INVALID_HANDLE)
1.94 - {
1.95 - ClearArray(g_RTVMapList);
1.96 - }
1.97 -
1.98 - if (ReadMapList(g_MapList,
1.99 - g_mapFileSerial,
1.100 - "rockthevote",
1.101 - MAPLIST_FLAG_CLEARARRAY|MAPLIST_FLAG_MAPSFOLDER)
1.102 - == INVALID_HANDLE)
1.103 - {
1.104 - if (g_mapFileSerial == -1)
1.105 - {
1.106 - LogError("Unable to create a valid map list.");
1.107 - }
1.108 - }
1.109 -
1.110 - BuildMapMenu();
1.111 +{
1.112 g_CanRTV = true;
1.113 - CreateTimer(30.0, Timer_DelayRTV);
1.114 + g_RTVAllowed = false;
1.115 + CreateTimer(GetConVarFloat(g_Cvar_InitialDelay), Timer_DelayRTV, _, TIMER_FLAG_NO_MAPCHANGE);
1.116 }
1.117
1.118 public bool:OnClientConnect(client, String:rejectmsg[], maxlen)
1.119 {
1.120 - if(!g_CanRTV || IsFakeClient(client))
1.121 + if(IsFakeClient(client))
1.122 return true;
1.123
1.124 g_Voted[client] = false;
1.125 - g_Nominated[client] = false;
1.126
1.127 g_Voters++;
1.128 g_VotesNeeded = RoundToFloor(float(g_Voters) * GetConVarFloat(g_Cvar_Needed));
1.129 @@ -154,72 +140,30 @@
1.130
1.131 g_VotesNeeded = RoundToFloor(float(g_Voters) * GetConVarFloat(g_Cvar_Needed));
1.132
1.133 - if (g_Votes && g_Voters && g_Votes >= g_VotesNeeded && g_RTVAllowed && !g_RTVStarted)
1.134 + if (g_Votes &&
1.135 + g_Voters &&
1.136 + g_Votes >= g_VotesNeeded &&
1.137 + g_RTVAllowed )
1.138 {
1.139 - g_RTVStarted = true;
1.140 - CreateTimer(2.0, Timer_StartRTV, TIMER_FLAG_NO_MAPCHANGE);
1.141 + if (GetConVarInt(g_Cvar_RTVPostVoteAction) == 1 && HasEndOfMapVoteFinished())
1.142 + {
1.143 + return;
1.144 + }
1.145 +
1.146 + StartRTV();
1.147 }
1.148 }
1.149
1.150 -public Action:Command_Addmap(client, args)
1.151 +public Action:Command_RTV(client, args)
1.152 {
1.153 - if (args < 1)
1.154 - {
1.155 - ReplyToCommand(client, "[SM] Usage: sm_rtv_addmap <mapname>");
1.156 - return Plugin_Handled;
1.157 - }
1.158 -
1.159 - if (!g_CanRTV)
1.160 + if (!g_CanRTV || !client)
1.161 {
1.162 - ReplyToCommand(client, "[SM] RockTheVote is not available.");
1.163 - return Plugin_Handled;
1.164 - }
1.165 -
1.166 - decl String:mapname[64];
1.167 - GetCmdArg(1, mapname, sizeof(mapname));
1.168 -
1.169 - if (FindStringInArray(g_MapList, mapname) == -1)
1.170 - {
1.171 - ReplyToCommand(client, "%t", "Map was not found", mapname);
1.172 - return Plugin_Handled;
1.173 + return Plugin_Continue;
1.174 }
1.175
1.176 - if (GetArraySize(g_RTVMapList) > 0)
1.177 - {
1.178 - if (FindStringInArray(g_RTVMapList, mapname) != -1)
1.179 - {
1.180 - ReplyToCommand(client, "%t", "Map Already In Vote", mapname);
1.181 - return Plugin_Handled;
1.182 - }
1.183 -
1.184 - ShiftArrayUp(g_RTVMapList, 0);
1.185 - SetArrayString(g_RTVMapList, 0, mapname);
1.186 -
1.187 - while (GetArraySize(g_RTVMapList) > GetConVarInt(g_Cvar_Maps))
1.188 - {
1.189 - RemoveFromArray(g_RTVMapList, GetConVarInt(g_Cvar_Maps));
1.190 - }
1.191 - }
1.192 - else
1.193 - {
1.194 - PushArrayString(g_RTVMapList, mapname);
1.195 - }
1.196 -
1.197 - decl String:item[64];
1.198 - for (new i = 0; i < GetMenuItemCount(g_MapMenu); i++)
1.199 - {
1.200 - GetMenuItem(g_MapMenu, i, item, sizeof(item));
1.201 - if (strcmp(item, mapname) == 0)
1.202 - {
1.203 - RemoveMenuItem(g_MapMenu, i);
1.204 - break;
1.205 - }
1.206 - }
1.207 + AttemptRTV(client);
1.208
1.209 - ReplyToCommand(client, "%t", "Map Inserted", mapname);
1.210 - LogAction(client, -1, "\"%L\" inserted map \"%s\".", client, mapname);
1.211 -
1.212 - return Plugin_Handled;
1.213 + return Plugin_Continue;
1.214 }
1.215
1.216 public Action:Command_Say(client, args)
1.217 @@ -228,7 +172,7 @@
1.218 {
1.219 return Plugin_Continue;
1.220 }
1.221 -
1.222 +
1.223 decl String:text[192];
1.224 if (!GetCmdArgString(text, sizeof(text)))
1.225 {
1.226 @@ -242,301 +186,120 @@
1.227 startidx = 1;
1.228 }
1.229
1.230 + new ReplySource:old = SetCmdReplySource(SM_REPLY_TO_CHAT);
1.231 +
1.232 if (strcmp(text[startidx], "rtv", false) == 0 || strcmp(text[startidx], "rockthevote", false) == 0)
1.233 {
1.234 - if (!g_RTVAllowed)
1.235 - {
1.236 - PrintToChat(client, "[SM] %t", "RTV Not Allowed");
1.237 - return Plugin_Continue;
1.238 - }
1.239 -
1.240 - if (g_RTVEnded)
1.241 - {
1.242 - PrintToChat(client, "[SM] %t", "RTV Ended");
1.243 - return Plugin_Continue;
1.244 - }
1.245 -
1.246 - if (g_RTVStarted)
1.247 - {
1.248 - PrintToChat(client, "[SM] %t", "RTV Started");
1.249 - return Plugin_Continue;
1.250 - }
1.251 -
1.252 - if (GetClientCount(true) < GetConVarInt(g_Cvar_MinPlayers) && g_Votes == 0) // Should we keep checking g_Votes here?
1.253 - {
1.254 - PrintToChat(client, "[SM] %t", "Minimal Players Not Met");
1.255 - return Plugin_Continue;
1.256 - }
1.257 -
1.258 - if (g_Voted[client])
1.259 - {
1.260 - PrintToChat(client, "[SM] %t", "Already Voted");
1.261 - return Plugin_Continue;
1.262 - }
1.263 -
1.264 - new String:name[64];
1.265 - GetClientName(client, name, sizeof(name));
1.266 -
1.267 - g_Votes++;
1.268 - g_Voted[client] = true;
1.269 + AttemptRTV(client);
1.270 + }
1.271 +
1.272 + SetCmdReplySource(old);
1.273 +
1.274 + return Plugin_Continue;
1.275 +}
1.276 +
1.277 +AttemptRTV(client)
1.278 +{
1.279 + if (!g_RTVAllowed || (GetConVarInt(g_Cvar_RTVPostVoteAction) == 1 && HasEndOfMapVoteFinished()))
1.280 + {
1.281 + ReplyToCommand(client, "[SM] %t", "RTV Not Allowed");
1.282 + return;
1.283 + }
1.284
1.285 - PrintToChatAll("[SM] %t", "RTV Requested", name, g_Votes, g_VotesNeeded);
1.286 -
1.287 - if (g_Votes >= g_VotesNeeded)
1.288 - {
1.289 - g_RTVStarted = true;
1.290 - CreateTimer(2.0, Timer_StartRTV, TIMER_FLAG_NO_MAPCHANGE);
1.291 - }
1.292 - }
1.293 - else if (GetConVarBool(g_Cvar_Nominate) && strcmp(text[startidx], "nominate", false) == 0)
1.294 + if (!CanMapChooserStartVote())
1.295 {
1.296 - if (g_RTVEnded)
1.297 - {
1.298 - PrintToChat(client, "[SM] %t", "RTV Ended");
1.299 - return Plugin_Continue;
1.300 - }
1.301 -
1.302 - if (g_RTVStarted)
1.303 - {
1.304 - PrintToChat(client, "[SM] %t", "RTV Started");
1.305 - return Plugin_Continue;
1.306 - }
1.307 -
1.308 - if (g_Nominated[client])
1.309 - {
1.310 - PrintToChat(client, "[SM] %t", "Already Nominated");
1.311 - return Plugin_Continue;
1.312 - }
1.313 -
1.314 - if (GetArraySize(g_RTVMapList) >= GetConVarInt(g_Cvar_Maps))
1.315 - {
1.316 - PrintToChat(client, "[SM] %t", "Max Nominations");
1.317 - return Plugin_Continue;
1.318 - }
1.319 -
1.320 - DisplayMenu(g_MapMenu, client, MENU_TIME_FOREVER);
1.321 + ReplyToCommand(client, "[SM] %t", "RTV Started");
1.322 + return;
1.323 }
1.324
1.325 - return Plugin_Continue;
1.326 + if (GetClientCount(true) < GetConVarInt(g_Cvar_MinPlayers))
1.327 + {
1.328 + ReplyToCommand(client, "[SM] %t", "Minimal Players Not Met");
1.329 + return;
1.330 + }
1.331 +
1.332 + if (g_Voted[client])
1.333 + {
1.334 + ReplyToCommand(client, "[SM] %t", "Already Voted");
1.335 + return;
1.336 + }
1.337 +
1.338 + new String:name[64];
1.339 + GetClientName(client, name, sizeof(name));
1.340 +
1.341 + g_Votes++;
1.342 + g_Voted[client] = true;
1.343 +
1.344 + PrintToChatAll("[SM] %t", "RTV Requested", name, g_Votes, g_VotesNeeded);
1.345 +
1.346 + if (g_Votes >= g_VotesNeeded)
1.347 + {
1.348 + StartRTV();
1.349 + }
1.350 }
1.351
1.352 public Action:Timer_DelayRTV(Handle:timer)
1.353 {
1.354 g_RTVAllowed = true;
1.355 - g_RTVStarted = false;
1.356 - g_RTVEnded = false;
1.357 -}
1.358 -
1.359 -public Action:Timer_StartRTV(Handle:timer)
1.360 -{
1.361 - if (timer == g_RetryTimer)
1.362 - {
1.363 - g_RetryTimer = INVALID_HANDLE;
1.364 - }
1.365 -
1.366 - if (g_RetryTimer != INVALID_HANDLE)
1.367 - {
1.368 - return;
1.369 - }
1.370 -
1.371 - if (IsVoteInProgress())
1.372 - {
1.373 - // Can't start a vote, try again in 5 seconds.
1.374 - g_RetryTimer = CreateTimer(5.0, Timer_StartRTV, TIMER_FLAG_NO_MAPCHANGE);
1.375 - return;
1.376 - }
1.377 -
1.378 - PrintToChatAll("[SM] %t", "RTV Vote Ready");
1.379 -
1.380 - new Handle:MapVoteMenu = CreateMenu(Handler_MapMapVoteMenu, MenuAction:MENU_ACTIONS_ALL);
1.381 - SetMenuTitle(MapVoteMenu, "Rock The Vote");
1.382 -
1.383 - new Handle:tempMaps = CloneArray(g_MapList);
1.384 - decl String:map[32];
1.385 -
1.386 - GetCurrentMap(map, sizeof(map));
1.387 - new index = FindStringInArray(tempMaps, map);
1.388 - if (index != -1)
1.389 - {
1.390 - RemoveFromArray(tempMaps, index);
1.391 - }
1.392 -
1.393 - // We assume that g_RTVMapList is within the correct limits, based on the logic for nominations
1.394 - for (new i = 0; i < GetArraySize(g_RTVMapList); i++)
1.395 - {
1.396 - GetArrayString(g_RTVMapList, i, map, sizeof(map));
1.397 - AddMenuItem(MapVoteMenu, map, map);
1.398 -
1.399 - index = FindStringInArray(tempMaps, map);
1.400 - if (index != -1)
1.401 - {
1.402 - RemoveFromArray(tempMaps, index);
1.403 - }
1.404 - }
1.405 -
1.406 - new limit = GetConVarInt(g_Cvar_Maps) - GetArraySize(g_RTVMapList);
1.407 - if (limit > GetArraySize(tempMaps))
1.408 - {
1.409 - limit = GetArraySize(tempMaps);
1.410 - }
1.411 -
1.412 - for (new i = 0; i < limit; i++)
1.413 - {
1.414 - new b = GetRandomInt(0, GetArraySize(tempMaps) - 1);
1.415 - GetArrayString(tempMaps, b, map, sizeof(map));
1.416 - PushArrayString(g_RTVMapList, map);
1.417 - AddMenuItem(MapVoteMenu, map, map);
1.418 - RemoveFromArray(tempMaps, b);
1.419 - }
1.420 -
1.421 - CloseHandle(tempMaps);
1.422 -
1.423 - AddMenuItem(MapVoteMenu, "Don't Change", "Don't Change");
1.424 -
1.425 - SetMenuExitButton(MapVoteMenu, false);
1.426 - VoteMenuToAll(MapVoteMenu, 20);
1.427 -
1.428 - LogMessage("[SM] Rockthevote was successfully started.");
1.429 -}
1.430 -
1.431 -public Action:Timer_ChangeMap(Handle:hTimer, Handle:dp)
1.432 -{
1.433 - new String:map[65];
1.434 -
1.435 - ResetPack(dp);
1.436 - ReadPackString(dp, map, sizeof(map));
1.437 -
1.438 - ServerCommand("changelevel \"%s\"", map);
1.439 -
1.440 - return Plugin_Stop;
1.441 }
1.442
1.443 -public Handler_MapMapVoteMenu(Handle:menu, MenuAction:action, param1, param2)
1.444 +StartRTV()
1.445 {
1.446 - switch (action)
1.447 + if (g_InChange)
1.448 {
1.449 - case MenuAction_End:
1.450 - {
1.451 - CloseHandle(menu);
1.452 - }
1.453 -
1.454 - case MenuAction_Display:
1.455 - {
1.456 - decl String:oldTitle[255], String:buffer[255];
1.457 - GetMenuTitle(menu, oldTitle, sizeof(oldTitle));
1.458 - Format(buffer, sizeof(buffer), "%T", oldTitle, param1);
1.459 -
1.460 - new Handle:panel = Handle:param2;
1.461 - SetPanelTitle(panel, buffer);
1.462 - }
1.463 -
1.464 - case MenuAction_DisplayItem:
1.465 - {
1.466 - if (GetMenuItemCount(menu) - 1 == param2)
1.467 - {
1.468 - decl String:buffer[255];
1.469 - Format(buffer, sizeof(buffer), "%T", "Don't Change", param1);
1.470 - return RedrawMenuItem(buffer);
1.471 - }
1.472 - }
1.473 -
1.474 - // Why am I commented out? Because BAIL hasn't decided yet if
1.475 - // vote notification will be built into the Vote API.
1.476 - /*case MenuAction_Select:
1.477 - {
1.478 - decl String:Name[32], String:Map[32];
1.479 - GetClientName(param1, Name, sizeof(Name));
1.480 - GetMenuItem(menu, param2, Map, sizeof(Map));
1.481 -
1.482 - PrintToChatAll("[SM] %s has voted for map '%s'", Name, Map);
1.483 - }*/
1.484 -
1.485 - case MenuAction_VoteCancel:
1.486 - {
1.487 - if (param1 == VoteCancel_NoVotes)
1.488 - {
1.489 - PrintToChatAll("[SM] %t", "No Votes");
1.490 - g_RTVEnded = true;
1.491 - }
1.492 - }
1.493 -
1.494 - case MenuAction_VoteEnd:
1.495 - {
1.496 - new String:map[64];
1.497 -
1.498 - GetMenuItem(menu, param1, map, sizeof(map));
1.499 -
1.500 - if (GetMenuItemCount(menu) - 1 == param1) // This should always match the "Keep Current" option
1.501 - {
1.502 - PrintToChatAll("[SM] %t", "Current Map Stays");
1.503 - LogMessage("[SM] Rockthevote has ended, current map kept.");
1.504 - }
1.505 - else
1.506 - {
1.507 - PrintToChatAll("[SM] %t", "Changing Maps", map);
1.508 - LogMessage("[SM] Rockthevote has ended, changing to map %s.", map);
1.509 - new Handle:dp;
1.510 - CreateDataTimer(5.0, Timer_ChangeMap, dp);
1.511 - WritePackString(dp, map);
1.512 - }
1.513 -
1.514 - g_RTVEnded = true;
1.515 - }
1.516 + return;
1.517 }
1.518
1.519 - return 0;
1.520 -}
1.521 -
1.522 -public Handler_MapSelectMenu(Handle:menu, MenuAction:action, param1, param2)
1.523 -{
1.524 - switch (action)
1.525 + if (HasEndOfMapVoteFinished())
1.526 {
1.527 - case MenuAction_Select:
1.528 + /* Change right now then */
1.529 + new String:map[65];
1.530 + if (GetNextMap(map, sizeof(map)))
1.531 {
1.532 - if (GetArraySize(g_RTVMapList) >= GetConVarInt(g_Cvar_Maps))
1.533 - {
1.534 - PrintToChat(param1, "[SM] %t", "Max Nominations");
1.535 - return;
1.536 - }
1.537 + PrintToChatAll("[SM] %t", "Changing Maps", map);
1.538 + CreateTimer(5.0, Timer_ChangeMap, _, TIMER_FLAG_NO_MAPCHANGE);
1.539 + g_InChange = true;
1.540 +
1.541 + ResetRTV();
1.542
1.543 - decl String:map[64], String:name[64];
1.544 - GetMenuItem(menu, param2, map, sizeof(map));
1.545 -
1.546 - if (FindStringInArray(g_RTVMapList, map) != -1)
1.547 - {
1.548 - PrintToChat(param1, "[SM] %t", "Map Already Nominated");
1.549 - return;
1.550 - }
1.551 -
1.552 - GetClientName(param1, name, 64);
1.553 -
1.554 - PushArrayString(g_RTVMapList, map);
1.555 - RemoveMenuItem(menu, param2);
1.556 -
1.557 - g_Nominated[param1] = true;
1.558 -
1.559 - PrintToChatAll("[SM] %t", "Map Nominated", name, map);
1.560 + g_RTVAllowed = false;
1.561 }
1.562 + return;
1.563 + }
1.564 +
1.565 + if (CanMapChooserStartVote())
1.566 + {
1.567 + new MapChange:when = MapChange:GetConVarInt(g_Cvar_ChangeTime);
1.568 + InitiateMapChooserVote(when);
1.569 +
1.570 + ResetRTV();
1.571 +
1.572 + g_RTVAllowed = false;
1.573 + CreateTimer(GetConVarFloat(g_Cvar_Interval), Timer_DelayRTV, _, TIMER_FLAG_NO_MAPCHANGE);
1.574 }
1.575 }
1.576
1.577 -BuildMapMenu()
1.578 +ResetRTV()
1.579 {
1.580 - if (g_MapMenu != INVALID_HANDLE)
1.581 + g_Votes = 0;
1.582 +
1.583 + for (new i=1; i<=MAXPLAYERS; i++)
1.584 {
1.585 - CloseHandle(g_MapMenu);
1.586 - g_MapMenu = INVALID_HANDLE;
1.587 + g_Voted[i] = false;
1.588 + }
1.589 +}
1.590 +
1.591 +public Action:Timer_ChangeMap(Handle:hTimer)
1.592 +{
1.593 + g_InChange = false;
1.594 +
1.595 + LogMessage("RTV changing map manually");
1.596 +
1.597 + new String:map[65];
1.598 + if (GetNextMap(map, sizeof(map)))
1.599 + {
1.600 + ServerCommand("changelevel \"%s\"", map);
1.601 }
1.602
1.603 - g_MapMenu = CreateMenu(Handler_MapSelectMenu);
1.604 - SetMenuTitle(g_MapMenu, "%t", "Nominate Title");
1.605 -
1.606 - decl String:map[64];
1.607 - for (new i = 0; i < GetArraySize(g_MapList); i++)
1.608 - {
1.609 - GetArrayString(g_MapList, i, map, sizeof(map));
1.610 - AddMenuItem(g_MapMenu, map, map);
1.611 - }
1.612 -
1.613 - SetMenuExitButton(g_MapMenu, false);
1.614 + return Plugin_Stop;
1.615 }
1.616 \ No newline at end of file