mapchooser_extended: small cleanup, nominations_extended: made sm_nomlist work through rcon
This commit is contained in:
		
							parent
							
								
									51f1adf0a1
								
							
						
					
					
						commit
						57ec45c86d
					
				@ -2594,6 +2594,7 @@ stock int FindIntInArray(int[] array, int size, int value)
 | 
			
		||||
	return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
stock void InternalRestoreMapCooldowns()
 | 
			
		||||
{
 | 
			
		||||
	char sCooldownFile[PLATFORM_MAX_PATH];
 | 
			
		||||
@ -2632,7 +2633,7 @@ stock void InternalRestoreMapCooldowns()
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if((Cooldown = Cooldowns.GetNum("cd", -1)) > 0)
 | 
			
		||||
		if((Cooldown = Cooldowns.GetNum("Cooldown", -1)) > 0)
 | 
			
		||||
		{
 | 
			
		||||
			LogMessage("Restored cooldown: %s -> %d", map, Cooldown);
 | 
			
		||||
			g_OldMapList.SetValue(map, Cooldown, true);
 | 
			
		||||
@ -2654,31 +2655,6 @@ stock void InternalStoreMapCooldowns()
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	KeyValues Cooldowns = new KeyValues("mapchooser_extended");
 | 
			
		||||
	if(!Cooldowns.ImportFromFile(sCooldownFile))
 | 
			
		||||
	{
 | 
			
		||||
		LogMessage("Unable to import cooldown file: \"%s\"", sCooldownFile);
 | 
			
		||||
		delete Cooldowns;
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	Cooldowns.Rewind();
 | 
			
		||||
	if (Cooldowns.GotoFirstSubKey())
 | 
			
		||||
	{
 | 
			
		||||
		for (;;)
 | 
			
		||||
		{
 | 
			
		||||
			if (Cooldowns.DeleteThis() < 1)
 | 
			
		||||
					break;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if(!Cooldowns.ExportToFile(sCooldownFile))
 | 
			
		||||
		{
 | 
			
		||||
			LogMessage("Unable to export cooldown file: \"%s\"", sCooldownFile);
 | 
			
		||||
			delete Cooldowns;
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	delete Cooldowns;
 | 
			
		||||
 | 
			
		||||
	Cooldowns = new KeyValues("mapchooser_extended");
 | 
			
		||||
	Cooldowns.Rewind();
 | 
			
		||||
	int Cooldown;
 | 
			
		||||
	char map[PLATFORM_MAX_PATH];
 | 
			
		||||
@ -2696,7 +2672,7 @@ stock void InternalStoreMapCooldowns()
 | 
			
		||||
			delete OldMapListSnapshot;
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
		Cooldowns.SetNum("cd", Cooldown);
 | 
			
		||||
		Cooldowns.SetNum("Cooldown", Cooldown);
 | 
			
		||||
		Cooldowns.Rewind();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -566,14 +566,30 @@ public Action Command_NominateList(int client, int args)
 | 
			
		||||
	GetNominatedMapList(MapList);
 | 
			
		||||
	if(!GetArraySize(MapList))
 | 
			
		||||
	{
 | 
			
		||||
		CPrintToChat(client, "[NE] No maps have been nominated.");
 | 
			
		||||
		ReplyToCommand(client, "[NE] No maps have been nominated.");
 | 
			
		||||
		delete MapList;
 | 
			
		||||
		return Plugin_Handled;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	static char map[PLATFORM_MAX_PATH];
 | 
			
		||||
 | 
			
		||||
	if (client == 0)
 | 
			
		||||
	{
 | 
			
		||||
		char aBuf[2048];
 | 
			
		||||
		StrCat(aBuf, sizeof(aBuf), "[NE] Nominated Maps:");
 | 
			
		||||
		for(int i = 0; i < GetArraySize(MapList); i++)
 | 
			
		||||
		{
 | 
			
		||||
			StrCat(aBuf, sizeof(aBuf), "\n");
 | 
			
		||||
			GetArrayString(MapList, i, map, sizeof(map));
 | 
			
		||||
			StrCat(aBuf, sizeof(aBuf), map);
 | 
			
		||||
		}
 | 
			
		||||
		ReplyToCommand(client, aBuf);
 | 
			
		||||
		delete MapList;
 | 
			
		||||
		return Plugin_Handled;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	Handle NominateListMenu = CreateMenu(Handler_NominateListMenu, MENU_ACTIONS_DEFAULT|MenuAction_DisplayItem);
 | 
			
		||||
 | 
			
		||||
	static char map[PLATFORM_MAX_PATH];
 | 
			
		||||
	for(int i = 0; i < GetArraySize(MapList); i++)
 | 
			
		||||
	{
 | 
			
		||||
		GetArrayString(MapList, i, map, sizeof(map));
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user