overhaul of the phrases for consistency
renamed config files for adminmenu cleaned up execcfg menu code --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401598
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
new Handle:g_ConfigMenu = INVALID_HANDLE;
|
||||
|
||||
PerformExec(client, String:path[])
|
||||
{
|
||||
if (!FileExists(path))
|
||||
@@ -26,7 +28,7 @@ public AdminMenu_ExecCFG(Handle:topmenu,
|
||||
}
|
||||
else if (action == TopMenuAction_SelectOption)
|
||||
{
|
||||
DisplayMenu(g_ConfigList, param, MENU_TIME_FOREVER);
|
||||
DisplayMenu(g_ConfigMenu, param, MENU_TIME_FOREVER);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,18 +67,27 @@ public Action:Command_ExecCfg(client, args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
new Handle:config_parser = INVALID_HANDLE;
|
||||
ParseConfigs()
|
||||
{
|
||||
new Handle:list = SMC_CreateParser();
|
||||
SMC_SetReaders(list, NewSection, KeyValue, EndSection);
|
||||
SMC_SetParseEnd(list, ParseEnd);
|
||||
if (config_parser == INVALID_HANDLE)
|
||||
{
|
||||
config_parser = SMC_CreateParser();
|
||||
}
|
||||
|
||||
new Handle:menu = CreateMenu(MenuHandler_ExecCFG);
|
||||
SetMenuTitle(menu, "Choose Config");
|
||||
SetMenuExitBackButton(menu, true);
|
||||
SMC_SetReaders(config_parser, NewSection, KeyValue, EndSection);
|
||||
|
||||
if (g_ConfigMenu != INVALID_HANDLE)
|
||||
{
|
||||
CloseHandle(g_ConfigMenu);
|
||||
}
|
||||
|
||||
g_ConfigMenu = CreateMenu(MenuHandler_ExecCFG);
|
||||
SetMenuTitle(g_ConfigMenu, "Choose Config");
|
||||
SetMenuExitBackButton(g_ConfigMenu, true);
|
||||
|
||||
decl String:configPath[256];
|
||||
BuildPath(Path_SM, configPath, sizeof(configPath), "configs/menu_configs.cfg");
|
||||
BuildPath(Path_SM, configPath, sizeof(configPath), "configs/adminmenu_cfgs.txt");
|
||||
|
||||
if (!FileExists(configPath))
|
||||
{
|
||||
@@ -85,9 +96,15 @@ ParseConfigs()
|
||||
return;
|
||||
}
|
||||
|
||||
g_ConfigList = menu;
|
||||
|
||||
SMC_ParseFile(list, configPath);
|
||||
new line;
|
||||
new SMCError:err = SMC_ParseFile(config_parser, configPath, line);
|
||||
if (err != SMCError_Okay)
|
||||
{
|
||||
decl String:error[256];
|
||||
SMC_GetErrorString(err, error, sizeof(error));
|
||||
LogError("Could not parse file (line %d, file \"%s\"):", line, configPath);
|
||||
LogError("Parser encountered error: %s", error);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -99,18 +116,10 @@ public SMCResult:NewSection(Handle:smc, const String:name[], bool:opt_quotes)
|
||||
|
||||
public SMCResult:KeyValue(Handle:smc, const String:key[], const String:value[], bool:key_quotes, bool:value_quotes)
|
||||
{
|
||||
AddMenuItem(g_ConfigList, key, value);
|
||||
AddMenuItem(g_ConfigMenu, key, value);
|
||||
}
|
||||
|
||||
public SMCResult:EndSection(Handle:smc)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ParseEnd(Handle:smc, bool:halted, bool:failed)
|
||||
{
|
||||
if (halted || failed)
|
||||
LogError("Reading of configs file failed");
|
||||
|
||||
CloseHandle(smc);
|
||||
}
|
||||
@@ -85,7 +85,7 @@ public Action:Timer_ChangeMap(Handle:timer, Handle:dp)
|
||||
LoadMaps(Handle:menu)
|
||||
{
|
||||
decl String:mapPath[256];
|
||||
BuildPath(Path_SM, mapPath, sizeof(mapPath), "configs/menu_maplist.ini");
|
||||
BuildPath(Path_SM, mapPath, sizeof(mapPath), "configs/adminmenu_maplist.ini");
|
||||
|
||||
if (!FileExists(mapPath))
|
||||
{
|
||||
@@ -113,8 +113,6 @@ LoadMaps(Handle:menu)
|
||||
RemoveAllMenuItems(menu);
|
||||
}
|
||||
|
||||
LogMessage("[SM] Loading menu map list file [%s]", mapPath);
|
||||
|
||||
new Handle:file = OpenFile(mapPath, "rt");
|
||||
if (file == INVALID_HANDLE)
|
||||
{
|
||||
@@ -183,4 +181,4 @@ LoadMapFolder(Handle:menu)
|
||||
CloseHandle(mapDir);
|
||||
|
||||
return GetMenuItemCount(menu);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ DisplayWhoMenu(client)
|
||||
new Handle:menu = CreateMenu(MenuHandler_Who);
|
||||
|
||||
decl String:title[100];
|
||||
Format(title, sizeof(title), "%T:", "Check player access", client);
|
||||
Format(title, sizeof(title), "%T:", "Identify player", client);
|
||||
SetMenuTitle(menu, title);
|
||||
SetMenuExitBackButton(menu, true);
|
||||
|
||||
@@ -41,7 +41,7 @@ public AdminMenu_Who(Handle:topmenu,
|
||||
{
|
||||
if (action == TopMenuAction_DisplayOption)
|
||||
{
|
||||
Format(buffer, maxlength, "%T", "Check player access", param);
|
||||
Format(buffer, maxlength, "%T", "Identify player", param);
|
||||
}
|
||||
else if (action == TopMenuAction_SelectOption)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user