mapchooser: how the fuck am I supposed to know that param1 = client???
This commit is contained in:
		
							parent
							
								
									95e8bf6475
								
							
						
					
					
						commit
						e2a2c37d97
					
				| @ -58,7 +58,6 @@ Handle g_Cvar_ExcludeCurrent = INVALID_HANDLE; | ||||
| Handle g_MapList = INVALID_HANDLE; | ||||
| Handle g_AdminMapList = INVALID_HANDLE; | ||||
| Menu g_MapMenu; | ||||
| Menu g_VIPMapMenu; | ||||
| Menu g_AdminMapMenu; | ||||
| int g_mapFileSerial = -1; | ||||
| int g_AdminMapFileSerial = -1; | ||||
| @ -191,11 +190,6 @@ void UpdateMapMenus() | ||||
| 
 | ||||
| 	g_MapMenu = BuildMapMenu(""); | ||||
| 
 | ||||
| 	if(g_VIPMapMenu != INVALID_HANDLE) | ||||
| 		delete g_VIPMapMenu; | ||||
| 
 | ||||
| 	g_VIPMapMenu = BuildVIPMapMenu(""); | ||||
| 
 | ||||
| 	if(g_AdminMapMenu != INVALID_HANDLE) | ||||
| 		delete g_AdminMapMenu; | ||||
| 
 | ||||
| @ -642,18 +636,8 @@ public int Handler_NominateListMenu(Menu menu, MenuAction action, int param1, in | ||||
| void AttemptNominate(int client, const char[] filter = "") | ||||
| { | ||||
| 	Menu menu = g_MapMenu; | ||||
| 
 | ||||
| 	if(CheckCommandAccess(client, "sm_tag", ADMFLAG_CUSTOM1) || CheckCommandAccess(client, "sm_kick", ADMFLAG_KICK)) | ||||
| 	{ | ||||
| 		menu = g_VIPMapMenu; | ||||
| 		if(filter[0]) | ||||
| 			menu = BuildVIPMapMenu(filter); | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
| 	if(filter[0]) | ||||
| 		menu = BuildMapMenu(filter); | ||||
| 	} | ||||
| 
 | ||||
| 	SetMenuTitle(menu, "%T", "Nominate Title", client); | ||||
| 	DisplayMenu(menu, client, MENU_TIME_FOREVER); | ||||
| @ -694,27 +678,6 @@ Menu BuildMapMenu(const char[] filter) | ||||
| 	return menu; | ||||
| } | ||||
| 
 | ||||
| Menu BuildVIPMapMenu(const char[] filter) | ||||
| { | ||||
| 	Menu menu = CreateMenu(Handler_VIPMapSelectMenu, MENU_ACTIONS_DEFAULT|MenuAction_DrawItem|MenuAction_DisplayItem); | ||||
| 
 | ||||
| 	static char map[PLATFORM_MAX_PATH]; | ||||
| 
 | ||||
| 	for(int i = 0; i < GetArraySize(g_MapList); i++) | ||||
| 	{ | ||||
| 		GetArrayString(g_MapList, i, map, sizeof(map)); | ||||
| 
 | ||||
| 		if(!filter[0] || StrContains(map, filter, false) != -1) | ||||
| 		{ | ||||
| 			AddMenuItem(menu, map, map); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	SetMenuExitButton(menu, true); | ||||
| 
 | ||||
| 	return menu; | ||||
| } | ||||
| 
 | ||||
| Menu BuildAdminMapMenu(const char[] filter) | ||||
| { | ||||
| 	Menu menu = CreateMenu(Handler_AdminMapSelectMenu, MENU_ACTIONS_DEFAULT|MenuAction_DrawItem|MenuAction_DisplayItem); | ||||
| @ -811,7 +774,7 @@ public int Handler_MapSelectMenu(Menu menu, MenuAction action, int param1, int p | ||||
| 			if((status & MAPSTATUS_DISABLED) == MAPSTATUS_DISABLED) | ||||
| 				return ITEMDRAW_DISABLED; | ||||
| 
 | ||||
| 			if(GetMapTimeRestriction(map) || GetMapPlayerRestriction(map) || GetMapGroupRestriction(map, param1) >= 0 || GetMapVIPRestriction(map)) | ||||
| 			if(GetMapTimeRestriction(map) || GetMapPlayerRestriction(map) || GetMapGroupRestriction(map, param1) >= 0 || (GetMapVIPRestriction(map) && !(CheckCommandAccess(param1, "sm_tag", ADMFLAG_CUSTOM1) || CheckCommandAccess(param1, "sm_kick", ADMFLAG_KICK)))) | ||||
| 				return ITEMDRAW_DISABLED; | ||||
| 
 | ||||
| 			return ITEMDRAW_DEFAULT; | ||||
| @ -880,7 +843,7 @@ public int Handler_MapSelectMenu(Menu menu, MenuAction action, int param1, int p | ||||
| 			} | ||||
| 
 | ||||
| 			bool VIPRestriction = GetMapVIPRestriction(map); | ||||
| 			if(VIPRestriction) | ||||
| 			if((VIPRestriction) && !(CheckCommandAccess(param1, "sm_tag", ADMFLAG_CUSTOM1) || CheckCommandAccess(param1, "sm_kick", ADMFLAG_KICK))) | ||||
| 			{ | ||||
| 				Format(display, sizeof(display), "%s (%T)", buffer, "VIP Restriction", param1); | ||||
| 				return RedrawMenuItem(display); | ||||
| @ -921,174 +884,6 @@ public int Handler_MapSelectMenu(Menu menu, MenuAction action, int param1, int p | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| public int Handler_VIPMapSelectMenu(Menu menu, MenuAction action, int param1, int param2) | ||||
| { | ||||
| 	switch(action) | ||||
| 	{ | ||||
| 		case MenuAction_End: | ||||
| 		{ | ||||
| 			if(menu != g_MapMenu) | ||||
| 				delete menu; | ||||
| 		} | ||||
| 		case MenuAction_Select: | ||||
| 		{ | ||||
| 			if(g_Player_NominationDelay[param1] > GetTime()) | ||||
| 			{ | ||||
| 				PrintToChat(param1, "[NE] Please wait %d seconds before you can nominate again", g_Player_NominationDelay[param1] - GetTime()); | ||||
| 				DisplayMenuAtItem(menu, param1, GetMenuSelectionPosition(), MENU_TIME_FOREVER); | ||||
| 				return 0; | ||||
| 			} | ||||
| 
 | ||||
| 			static char map[PLATFORM_MAX_PATH]; | ||||
| 			char name[MAX_NAME_LENGTH]; | ||||
| 			GetMenuItem(menu, param2, map, sizeof(map)); | ||||
| 
 | ||||
| 			GetClientName(param1, name, MAX_NAME_LENGTH); | ||||
| 
 | ||||
| 			NominateResult result = NominateMap(map, false, param1); | ||||
| 
 | ||||
| 			/* Don't need to check for InvalidMap because the menu did that already */ | ||||
| 			if(result == Nominate_AlreadyInVote) | ||||
| 			{ | ||||
| 				PrintToChat(param1, "[NE] %t", "Map Already Nominated"); | ||||
| 				return 0; | ||||
| 			} | ||||
| 			else if(result == Nominate_VoteFull) | ||||
| 			{ | ||||
| 				PrintToChat(param1, "[NE] %t", "Max Nominations"); | ||||
| 				return 0; | ||||
| 			} | ||||
| 
 | ||||
| 			SetTrieValue(g_mapTrie, map, MAPSTATUS_DISABLED|MAPSTATUS_EXCLUDE_NOMINATED); | ||||
| 
 | ||||
| 			if(result == Nominate_Added) | ||||
| 				PrintToChatAll("[NE] %t", "Map Nominated", name, map); | ||||
| 			else if(result == Nominate_Replaced) | ||||
| 				PrintToChatAll("[NE] %t", "Map Nomination Changed", name, map); | ||||
| 
 | ||||
| 			LogMessage("%s nominated %s", name, map); | ||||
| 			g_Player_NominationDelay[param1] = GetTime() + GetConVarInt(g_Cvar_NominateDelay); | ||||
| 		} | ||||
| 
 | ||||
| 		case MenuAction_DrawItem: | ||||
| 		{ | ||||
| 			static char map[PLATFORM_MAX_PATH]; | ||||
| 			GetMenuItem(menu, param2, map, sizeof(map)); | ||||
| 
 | ||||
| 			int status; | ||||
| 
 | ||||
| 			if(!GetTrieValue(g_mapTrie, map, status)) | ||||
| 			{ | ||||
| 				LogError("Menu selection of item not in trie. Major logic problem somewhere."); | ||||
| 				return ITEMDRAW_DEFAULT; | ||||
| 			} | ||||
| 
 | ||||
| 			if((status & MAPSTATUS_DISABLED) == MAPSTATUS_DISABLED) | ||||
| 				return ITEMDRAW_DISABLED; | ||||
| 
 | ||||
| 			if(GetMapTimeRestriction(map) || GetMapPlayerRestriction(map) || GetMapGroupRestriction(map, param1) >= 0) | ||||
| 				return ITEMDRAW_DISABLED; | ||||
| 
 | ||||
| 			return ITEMDRAW_DEFAULT; | ||||
| 		} | ||||
| 
 | ||||
| 		case MenuAction_DisplayItem: | ||||
| 		{ | ||||
| 			static char map[PLATFORM_MAX_PATH]; | ||||
| 			GetMenuItem(menu, param2, map, sizeof(map)); | ||||
| 
 | ||||
| 			int mark = GetConVarInt(g_Cvar_MarkCustomMaps); | ||||
| 			bool official; | ||||
| 
 | ||||
| 			int status; | ||||
| 
 | ||||
| 			if(!GetTrieValue(g_mapTrie, map, status)) | ||||
| 			{ | ||||
| 				LogError("Menu selection of item not in trie. Major logic problem somewhere."); | ||||
| 				return 0; | ||||
| 			} | ||||
| 
 | ||||
| 			static char buffer[100]; | ||||
| 			static char display[150]; | ||||
| 
 | ||||
| 			if(mark) | ||||
| 				official = IsMapOfficial(map); | ||||
| 
 | ||||
| 			if(mark && !official) | ||||
| 			{ | ||||
| 				switch(mark) | ||||
| 				{ | ||||
| 					case 1: | ||||
| 					{ | ||||
| 						Format(buffer, sizeof(buffer), "%T", "Custom Marked", param1, map); | ||||
| 					} | ||||
| 
 | ||||
| 					case 2: | ||||
| 					{ | ||||
| 						Format(buffer, sizeof(buffer), "%T", "Custom", param1, map); | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 			else | ||||
| 				strcopy(buffer, sizeof(buffer), map); | ||||
| 
 | ||||
| 			if((status & MAPSTATUS_DISABLED) == MAPSTATUS_DISABLED) | ||||
| 			{ | ||||
| 				if((status & MAPSTATUS_EXCLUDE_CURRENT) == MAPSTATUS_EXCLUDE_CURRENT) | ||||
| 				{ | ||||
| 					Format(display, sizeof(display), "%s (%T)", buffer, "Current Map", param1); | ||||
| 					return RedrawMenuItem(display); | ||||
| 				} | ||||
| 
 | ||||
| 				if((status & MAPSTATUS_EXCLUDE_PREVIOUS) == MAPSTATUS_EXCLUDE_PREVIOUS) | ||||
| 				{ | ||||
| 					int Cooldown = GetMapCooldown(map); | ||||
| 					Format(display, sizeof(display), "%s (%T %d)", buffer, "Recently Played", param1, Cooldown); | ||||
| 					return RedrawMenuItem(display); | ||||
| 				} | ||||
| 
 | ||||
| 				if((status & MAPSTATUS_EXCLUDE_NOMINATED) == MAPSTATUS_EXCLUDE_NOMINATED) | ||||
| 				{ | ||||
| 					Format(display, sizeof(display), "%s (%T)", buffer, "Nominated", param1); | ||||
| 					return RedrawMenuItem(display); | ||||
| 				} | ||||
| 			} | ||||
| 
 | ||||
| 			int TimeRestriction = GetMapTimeRestriction(map); | ||||
| 			if(TimeRestriction) | ||||
| 			{ | ||||
| 				Format(display, sizeof(display), "%s (%T)", buffer, "Map Time Restriction", param1, "+", RoundToFloor(float(TimeRestriction / 60)), TimeRestriction % 60); | ||||
| 				return RedrawMenuItem(display); | ||||
| 			} | ||||
| 
 | ||||
| 			int PlayerRestriction = GetMapPlayerRestriction(map); | ||||
| 			if(PlayerRestriction) | ||||
| 			{ | ||||
| 				if(PlayerRestriction < 0) | ||||
| 					Format(display, sizeof(display), "%s (%T)", buffer, "Map Player Restriction", param1, "+", PlayerRestriction * -1); | ||||
| 				else | ||||
| 					Format(display, sizeof(display), "%s (%T)", buffer, "Map Player Restriction", param1, "-", PlayerRestriction); | ||||
| 
 | ||||
| 				return RedrawMenuItem(display); | ||||
| 			} | ||||
| 
 | ||||
| 			int GroupRestriction = GetMapGroupRestriction(map, param1); | ||||
| 			if(GroupRestriction >= 0) | ||||
| 			{ | ||||
| 				Format(display, sizeof(display), "%s (%T)", buffer, "Map Group Restriction", param1, GroupRestriction); | ||||
| 				return RedrawMenuItem(display); | ||||
| 			} | ||||
| 
 | ||||
| 			if(mark && !official) | ||||
| 				return RedrawMenuItem(buffer); | ||||
| 
 | ||||
| 			return 0; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	return 0; | ||||
| } | ||||
| 
 | ||||
| stock bool IsNominateAllowed(int client) | ||||
| { | ||||
| 	if (BaseComm_IsClientGagged(client)) | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 neon
						neon