View Single Post
backwards
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 01-12-2018 , 22:10   Re: [CSS] Menu with map elimination
Reply With Quote #7

I've accidentally placed cs_compound on the list twice, make sure to remove one of those copys and change MAXMAPS from 30 to 29.

PHP Code:
public int MainMenu_choose_map_all(Menu menuMenuAction actionint param1int param2)
{
    switch(
action)
    {
        case 
MenuAction_Select:
        {
            
char sItem[32];
            
menu.GetItem(param2sItemsizeof(sItem));
            
            
ClientCommand(param1"sm_setmap %s"sItem);
            
            for(
int map 0;map MAXMAPS;map++)
                if(!
maps_vetoed[map])
                    if(
StrEqual(sItemmaps[map]))
                        
maps_vetoed[map] = true;

            
            
int mapsleft 0;
            
int lastmapslot = -1;
            
            for(
int map 0;map MAXMAPS;map++)
                if(!
maps_vetoed[map])
                {
                    
mapsleft++;
                    
lastmapslot map;
                }
            
            if(
mapsleft == 1)
            {
                
PrintToChat(param1"last map was %s"maps[lastmapslot]);
                
delete menu;
                return 
0;
            }
            
            
choose_map_all();
        }
        case 
MenuAction_End:
        {
            
delete menu;
        }
    }
    return 
0;

__________________
I highly recommend joining the SourceMod Discord Server for real time support.
backwards is offline