Remove LogMessageEx definition from logging.inc (
bug 5897, r=kyles).
3 * =============================================================================
4 * SourceMod Basecommands Plugin
5 * Provides map functionality
7 * SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
8 * =============================================================================
10 * This program is free software; you can redistribute it and/or modify it under
11 * the terms of the GNU General Public License, version 3.0, as published by the
12 * Free Software Foundation.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 * You should have received a copy of the GNU General Public License along with
20 * this program. If not, see <http://www.gnu.org/licenses/>.
22 * As a special exception, AlliedModders LLC gives you permission to link the
23 * code of this program (as well as its derivative works) to "Half-Life 2," the
24 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
25 * by the Valve Corporation. You must obey the GNU General Public License in
26 * all respects for all other code used. Additionally, AlliedModders LLC grants
27 * this exception to all derivative works. AlliedModders LLC defines further
28 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
29 * or <http://www.sourcemod.net/license.php>.
34 public MenuHandler_ChangeMap(Handle:menu, MenuAction:action, param1, param2)
36 if (action == MenuAction_Cancel)
38 if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
40 DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
43 else if (action == MenuAction_Select)
47 GetMenuItem(menu, param2, map, sizeof(map));
49 ShowActivity2(param1, "[SM] ", "%t", "Changing map", map);
51 LogAction(param1, -1, "\"%L\" changed map to \"%s\"", param1, map);
54 CreateDataTimer(3.0, Timer_ChangeMap, dp);
55 WritePackString(dp, map);
57 else if (action == MenuAction_Display)
59 decl String:title[128];
60 Format(title, sizeof(title), "%T", "Please select a map", param1);
61 SetPanelTitle(Handle:param2, title);
65 public AdminMenu_Map(Handle:topmenu,
67 TopMenuObject:object_id,
72 if (action == TopMenuAction_DisplayOption)
74 Format(buffer, maxlength, "%T", "Choose Map", param);
76 else if (action == TopMenuAction_SelectOption)
78 DisplayMenu(g_MapList, param, MENU_TIME_FOREVER);
82 public Action:Command_Map(client, args)
86 ReplyToCommand(client, "[SM] Usage: sm_map <map>");
87 return Plugin_Handled;
91 GetCmdArg(1, map, sizeof(map));
95 ReplyToCommand(client, "[SM] %t", "Map was not found", map);
96 return Plugin_Handled;
99 ShowActivity2(client, "[SM] ", "%t", "Changing map", map);
101 LogAction(client, -1, "\"%L\" changed map to \"%s\"", client, map);
104 CreateDataTimer(3.0, Timer_ChangeMap, dp);
105 WritePackString(dp, map);
107 return Plugin_Handled;
110 public Action:Timer_ChangeMap(Handle:timer, Handle:dp)
115 ReadPackString(dp, map, sizeof(map));
117 ForceChangeLevel(map, "sm_map Command");
122 new Handle:g_map_array = INVALID_HANDLE;
123 new g_map_serial = -1;
125 LoadMapList(Handle:menu)
127 new Handle:map_array;
129 if ((map_array = ReadMapList(g_map_array,
132 MAPLIST_FLAG_CLEARARRAY|MAPLIST_FLAG_NO_DEFAULT|MAPLIST_FLAG_MAPSFOLDER))
135 g_map_array = map_array;
138 if (g_map_array == INVALID_HANDLE)
143 RemoveAllMenuItems(menu);
145 decl String:map_name[64];
146 new map_count = GetArraySize(g_map_array);
148 for (new i = 0; i < map_count; i++)
150 GetArrayString(g_map_array, i, map_name, sizeof(map_name));
151 AddMenuItem(menu, map_name, map_name);