Skip to content

Commit

Permalink
don't show !map menu when only 1 item
Browse files Browse the repository at this point in the history
  • Loading branch information
rtldg committed Oct 4, 2021
1 parent afed33e commit 276d74b
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion addons/sourcemod/scripting/shavit-mapchooser.sp
Original file line number Diff line number Diff line change
Expand Up @@ -2040,7 +2040,33 @@ public Action BaseCommands_Command_Map_Menu(int client, int args)
}
}

menu.Display(client, MENU_TIME_FOREVER);
delete maps;
delete tiersMap;

switch (menu.ItemCount)
{
case 0:
{
ReplyToCommand(client, "%s%t", g_cPrefix, "Map was not found", map);
delete menu;
}
case 1:
{
menu.GetItem(0, map, sizeof(map));
ShowActivity2(client, g_cPrefix, "%t", "Changing map", map);
LogAction(client, -1, "\"%L\" changed map to \"%s\"", client, map);

DataPack dp;
CreateDataTimer(MapChangeDelay(), Timer_ChangeMap, dp);
dp.WriteString(map);
dp.WriteString("sm_map");
delete menu;
}
default:
{
menu.Display(client, MENU_TIME_FOREVER);
}
}

return Plugin_Handled;
}
Expand Down

0 comments on commit 276d74b

Please sign in to comment.