update to display vote counts instead of names
This commit is contained in:
		
							parent
							
								
									ade335943b
								
							
						
					
					
						commit
						f3792affba
					
				@ -727,45 +727,77 @@ void AttemptAdminRemoveMap(int client, const char[] filter = "")
 | 
			
		||||
 | 
			
		||||
bool PopulateNominateListMenu(Menu menu, int client, const char[] filter = "")
 | 
			
		||||
{
 | 
			
		||||
	int arraySize = ByteCountToCells(PLATFORM_MAX_PATH);
 | 
			
		||||
	ArrayList MapList = CreateArray(arraySize);
 | 
			
		||||
	ArrayList OwnerList = CreateArray();
 | 
			
		||||
    int arraySize = ByteCountToCells(PLATFORM_MAX_PATH);
 | 
			
		||||
    ArrayList MapList = CreateArray(arraySize);
 | 
			
		||||
    ArrayList OwnerList = CreateArray();
 | 
			
		||||
 | 
			
		||||
	GetNominatedMapList(MapList, OwnerList);
 | 
			
		||||
	if(!GetArraySize(MapList))
 | 
			
		||||
	{
 | 
			
		||||
		delete MapList;
 | 
			
		||||
		delete OwnerList;
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
    GetNominatedMapList(MapList, OwnerList);
 | 
			
		||||
    if(!GetArraySize(MapList))
 | 
			
		||||
    {
 | 
			
		||||
        delete MapList;
 | 
			
		||||
        delete OwnerList;
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	static char map[PLATFORM_MAX_PATH];
 | 
			
		||||
	static char display[PLATFORM_MAX_PATH];
 | 
			
		||||
	for(int i = 0; i < GetArraySize(MapList); i++)
 | 
			
		||||
	{
 | 
			
		||||
		GetArrayString(MapList, i, map, sizeof(map));
 | 
			
		||||
    StringMap sm = new StringMap();
 | 
			
		||||
    static char map[PLATFORM_MAX_PATH];
 | 
			
		||||
    static char display[PLATFORM_MAX_PATH];
 | 
			
		||||
    for(int i = 0; i < GetArraySize(MapList); i++)
 | 
			
		||||
    {
 | 
			
		||||
        GetArrayString(MapList, i, map, sizeof(map));
 | 
			
		||||
 | 
			
		||||
		if(!filter[0] || StrContains(map, filter, false) != -1)
 | 
			
		||||
		{
 | 
			
		||||
			strcopy(display, sizeof(display), map);
 | 
			
		||||
        if(!filter[0] || StrContains(map, filter, false) != -1)
 | 
			
		||||
        {
 | 
			
		||||
            int nominate_count_for_particular_map = 0;
 | 
			
		||||
            sm.GetValue(map, nominate_count_for_particular_map);
 | 
			
		||||
            nominate_count_for_particular_map++;
 | 
			
		||||
            sm.SetValue(map, nominate_count_for_particular_map, true);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    for(int i = 0; i < GetArraySize(MapList); i++)
 | 
			
		||||
    {
 | 
			
		||||
        GetArrayString(MapList, i, map, sizeof(map));
 | 
			
		||||
 | 
			
		||||
			bool VIPRestriction = GetMapVIPRestriction(map);
 | 
			
		||||
			if((VIPRestriction) && AreRestrictionsActive())
 | 
			
		||||
				Format(display, sizeof(display), "%s (%T)", display, "VIP Nomination", client);
 | 
			
		||||
        if(!filter[0] || StrContains(map, filter, false) != -1)
 | 
			
		||||
        {
 | 
			
		||||
            int nominate_count_for_particular_map = 0;
 | 
			
		||||
            sm.GetValue(map, nominate_count_for_particular_map);
 | 
			
		||||
            if (nominate_count_for_particular_map == -1)
 | 
			
		||||
            {
 | 
			
		||||
                //we already displayed vote count for this particular map
 | 
			
		||||
                continue;
 | 
			
		||||
            }
 | 
			
		||||
            strcopy(display, sizeof(display), map);
 | 
			
		||||
 | 
			
		||||
			int owner = GetArrayCell(OwnerList, i);
 | 
			
		||||
			if(!owner)
 | 
			
		||||
				Format(display, sizeof(display), "%s (Admin)", display);
 | 
			
		||||
			else
 | 
			
		||||
				Format(display, sizeof(display), "%s (%N)", display, owner);
 | 
			
		||||
            bool VIPRestriction = GetMapVIPRestriction(map);
 | 
			
		||||
            if((VIPRestriction) && AreRestrictionsActive())
 | 
			
		||||
                Format(display, sizeof(display), "%s (%T)", display, "VIP Nomination", client);
 | 
			
		||||
 | 
			
		||||
			AddMenuItem(menu, map, display);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
            int owner = GetArrayCell(OwnerList, i);
 | 
			
		||||
            char spelling[8];
 | 
			
		||||
            if (nominate_count_for_particular_map == 1)
 | 
			
		||||
            {
 | 
			
		||||
                Format(spelling, sizeof(spelling), "Vote");
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                
 | 
			
		||||
	delete MapList;
 | 
			
		||||
	delete OwnerList;
 | 
			
		||||
	return true;
 | 
			
		||||
                Format(spelling, sizeof(spelling), "Votes");
 | 
			
		||||
            }
 | 
			
		||||
            if(!owner)
 | 
			
		||||
                Format(display, sizeof(display), "%s (Admin)", display);
 | 
			
		||||
            else
 | 
			
		||||
                Format(display, sizeof(display), "%s (%i %s)", display, nominate_count_for_particular_map, spelling);
 | 
			
		||||
            nominate_count_for_particular_map = -1;
 | 
			
		||||
            sm.SetValue(map, nominate_count_for_particular_map, true);
 | 
			
		||||
            AddMenuItem(menu, map, display);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    delete MapList;
 | 
			
		||||
    delete OwnerList;
 | 
			
		||||
    delete sm;
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Menu BuildMapMenu(const char[] filter, int client)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user