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:
David Anderson
2007-10-16 18:37:24 +00:00
parent 2b15d877aa
commit 5d72810449
24 changed files with 129 additions and 115 deletions
+6 -4
View File
@@ -36,7 +36,7 @@ DisplayBanTargetMenu(client)
new Handle:menu = CreateMenu(MenuHandler_BanPlayerList);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Ban Player", client);
Format(title, sizeof(title), "%T:", "Ban player", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
@@ -50,7 +50,7 @@ DisplayBanTimeMenu(client)
new Handle:menu = CreateMenu(MenuHandler_BanTimeList);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Ban Player", client);
Format(title, sizeof(title), "%T:", "Ban player", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
@@ -70,10 +70,12 @@ DisplayBanReasonMenu(client)
new Handle:menu = CreateMenu(MenuHandler_BanReasonList);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Ban Reason", client);
Format(title, sizeof(title), "%T:", "Ban reason", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
/* :TODO: we should either remove this or make it configurable */
AddMenuItem(menu, "Abusive", "Abusive");
AddMenuItem(menu, "Racism", "Racism");
AddMenuItem(menu, "General cheating/exploits", "General cheating/exploits");
@@ -100,7 +102,7 @@ public AdminMenu_Ban(Handle:topmenu,
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Ban Player", param);
Format(buffer, maxlength, "%T", "Ban player", param);
}
else if (action == TopMenuAction_SelectOption)
{
+2 -2
View File
@@ -55,7 +55,7 @@ DisplayGagPlayerMenu(client)
new Handle:menu = CreateMenu(MenuHandler_GagPlayer);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Gag/Mute Player", client);
Format(title, sizeof(title), "%T:", "Gag/Mute player", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
@@ -73,7 +73,7 @@ public AdminMenu_Gag(Handle:topmenu,
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Gag/Mute Player", param);
Format(buffer, maxlength, "%T", "Gag/Mute player", param);
}
else if (action == TopMenuAction_SelectOption)
{
+1 -12
View File
@@ -51,8 +51,6 @@ new Handle:hTopMenu = INVALID_HANDLE;
new Handle:g_MapList;
new g_mapFileTime;
new Handle:g_ConfigList;
#include "basecommands/kick.sp"
#include "basecommands/reloadadmins.sp"
#include "basecommands/cancelvote.sp"
@@ -93,15 +91,6 @@ public OnMapStart()
ParseConfigs();
}
public OnMapEnd()
{
if (g_ConfigList != INVALID_HANDLE)
{
CloseHandle(g_ConfigList);
g_ConfigList = INVALID_HANDLE;
}
}
public OnAdminMenuReady(Handle:topmenu)
{
/* Block us from being called twice */
@@ -127,7 +116,7 @@ public OnAdminMenuReady(Handle:topmenu)
ADMFLAG_KICK);
AddToTopMenu(hTopMenu,
"Get Info",
"Identify",
TopMenuObject_Item,
AdminMenu_Who,
player_commands,
+29 -20
View File
@@ -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);
}
+2 -4
View File
@@ -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);
}
}
+2 -2
View File
@@ -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)
{
+3 -3
View File
@@ -6,7 +6,7 @@ PerformBurn(client, target, Float:seconds)
if (!IsPlayerAlive(target))
{
ReplyToCommand(client, "[SM] %t", "Cannot performed on dead", name);
ReplyToCommand(client, "[SM] %t", "Cannot be performed on dead", name);
return;
}
@@ -20,7 +20,7 @@ DisplayBurnMenu(client)
new Handle:menu = CreateMenu(MenuHandler_Burn);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Burn Player", client);
Format(title, sizeof(title), "%T:", "Burn player", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
@@ -38,7 +38,7 @@ public AdminMenu_Burn(Handle:topmenu,
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Burn Player", param);
Format(buffer, maxlength, "%T", "Burn player", param);
}
else if (action == TopMenuAction_SelectOption)
{
+4 -4
View File
@@ -6,7 +6,7 @@ PerformSlap(client, target, damage)
if (!IsPlayerAlive(target))
{
ReplyToCommand(client, "[SM] %t", "Cannot performed on dead", name);
ReplyToCommand(client, "[SM] %t", "Cannot be performed on dead", name);
return;
}
@@ -20,7 +20,7 @@ DisplaySlapDamageMenu(client)
new Handle:menu = CreateMenu(MenuHandler_SlapDamage);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Slap Damage", client);
Format(title, sizeof(title), "%T:", "Slap damage", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
@@ -40,7 +40,7 @@ DisplaySlapTargetMenu(client)
new Handle:menu = CreateMenu(MenuHandler_Slap);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Slap Player", client);
Format(title, sizeof(title), "%T:", "Slap player", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
@@ -58,7 +58,7 @@ public AdminMenu_Slap(Handle:topmenu,
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Slap Player", param);
Format(buffer, maxlength, "%T", "Slap player", param);
}
else if (action == TopMenuAction_SelectOption)
{
+1 -1
View File
@@ -7,7 +7,7 @@ PerformSlay(client, target)
if (!IsPlayerAlive(target))
{
ReplyToCommand(client, "[SM] %t", "Cannot performed on dead", name);
ReplyToCommand(client, "[SM] %t", "Cannot be performed on dead", name);
return;
}
+5 -5
View File
@@ -146,7 +146,7 @@ public OnAdminMenuReady(Handle:topmenu)
if (voting_commands != INVALID_TOPMENUOBJECT)
{
AddToTopMenu(hTopMenu,
"Vote Gravity",
"Gravity Vote",
TopMenuObject_Item,
AdminMenu_VoteGravity,
voting_commands,
@@ -154,7 +154,7 @@ public OnAdminMenuReady(Handle:topmenu)
ADMFLAG_VOTE);
AddToTopMenu(hTopMenu,
"Vote Burn",
"Burn Vote",
TopMenuObject_Item,
AdminMenu_VoteBurn,
voting_commands,
@@ -162,7 +162,7 @@ public OnAdminMenuReady(Handle:topmenu)
ADMFLAG_VOTE|ADMFLAG_SLAY);
AddToTopMenu(hTopMenu,
"Vote Slay",
"Slay Vote",
TopMenuObject_Item,
AdminMenu_VoteSlay,
voting_commands,
@@ -170,7 +170,7 @@ public OnAdminMenuReady(Handle:topmenu)
ADMFLAG_VOTE|ADMFLAG_SLAY);
AddToTopMenu(hTopMenu,
"Vote AllTalk",
"Alltalk Vote",
TopMenuObject_Item,
AdminMenu_VoteAllTalk,
voting_commands,
@@ -178,7 +178,7 @@ public OnAdminMenuReady(Handle:topmenu)
ADMFLAG_VOTE);
AddToTopMenu(hTopMenu,
"Vote FF",
"FF Vote",
TopMenuObject_Item,
AdminMenu_VoteFF,
voting_commands,
+1 -1
View File
@@ -44,7 +44,7 @@ public AdminMenu_VoteAllTalk(Handle:topmenu,
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Vote AllTalk", param);
Format(buffer, maxlength, "%T", "Alltalk vote", param);
}
else if (action == TopMenuAction_SelectOption)
{
+9 -5
View File
@@ -2,7 +2,7 @@ DisplayVoteBurnMenu(client,target,String:name[])
{
if (!IsPlayerAlive(target))
{
ReplyToCommand(client, "[SM] %t", "Cannot performed on dead", name);
ReplyToCommand(client, "[SM] %t", "Cannot be performed on dead", name);
return;
}
@@ -15,7 +15,7 @@ DisplayVoteBurnMenu(client,target,String:name[])
g_voteType = voteType:burn;
g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
SetMenuTitle(g_hVoteMenu, "Voteburn Player");
SetMenuTitle(g_hVoteMenu, "Voteburn player");
AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
SetMenuExitButton(g_hVoteMenu, false);
@@ -27,7 +27,7 @@ DisplayBurnTargetMenu(client)
new Handle:menu = CreateMenu(MenuHandler_Burn);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Vote Burn", client);
Format(title, sizeof(title), "%T:", "Burn vote", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
@@ -45,7 +45,7 @@ public AdminMenu_VoteBurn(Handle:topmenu,
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Vote Burn", param);
Format(buffer, maxlength, "%T", "Burn vote", param);
}
else if (action == TopMenuAction_SelectOption)
{
@@ -87,6 +87,10 @@ public MenuHandler_Burn(Handle:menu, MenuAction:action, param1, param2)
{
PrintToChat(param1, "[SM] %t", "Unable to target");
}
else if (!IsPlayerAlive(target))
{
PrintToChat(param1, "[SM] %t", "Player has since died");
}
else
{
DisplayVoteBurnMenu(param1, target, name);
@@ -127,4 +131,4 @@ public Action:Command_VoteBurn(client, args)
DisplayVoteBurnMenu(client, target, arg);
return Plugin_Handled;
}
}
+1 -1
View File
@@ -40,7 +40,7 @@ public AdminMenu_VoteGravity(Handle:topmenu,
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Vote Gravity", param);
Format(buffer, maxlength, "%T", "Gravity vote", param);
}
else if (action == TopMenuAction_SelectOption)
{
+7 -3
View File
@@ -3,7 +3,7 @@ DisplayVoteSlayMenu(client,target,String:name[])
{
if (!IsPlayerAlive(target))
{
ReplyToCommand(client, "[SM] %t", "Cannot performed on dead", name);
ReplyToCommand(client, "[SM] %t", "Cannot be performed on dead", name);
return;
}
@@ -28,7 +28,7 @@ DisplaySlayTargetMenu(client)
new Handle:menu = CreateMenu(MenuHandler_Slay);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Vote Slay", client);
Format(title, sizeof(title), "%T:", "Slay vote", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
@@ -46,7 +46,7 @@ public AdminMenu_VoteSlay(Handle:topmenu,
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Vote Slay", param);
Format(buffer, maxlength, "%T", "Slay vote", param);
}
else if (action == TopMenuAction_SelectOption)
{
@@ -88,6 +88,10 @@ public MenuHandler_Slay(Handle:menu, MenuAction:action, param1, param2)
{
PrintToChat(param1, "[SM] %t", "Unable to target");
}
else if (!IsPlayerAlive(target))
{
PrintToChat(param1, "[SM] %t", "Player has since died");
}
else
{
DisplayVoteSlayMenu(param1, target, name);
+3 -3
View File
@@ -156,7 +156,7 @@ public OnAdminMenuReady(Handle:topmenu)
if (voting_commands != INVALID_TOPMENUOBJECT)
{
AddToTopMenu(hTopMenu,
"Vote Kick",
"Kick Vote",
TopMenuObject_Item,
AdminMenu_VoteKick,
voting_commands,
@@ -164,7 +164,7 @@ public OnAdminMenuReady(Handle:topmenu)
ADMFLAG_VOTE|ADMFLAG_KICK);
AddToTopMenu(hTopMenu,
"Vote Ban",
"Ban Vote",
TopMenuObject_Item,
AdminMenu_VoteBan,
voting_commands,
@@ -172,7 +172,7 @@ public OnAdminMenuReady(Handle:topmenu)
ADMFLAG_VOTE|ADMFLAG_BAN);
AddToTopMenu(hTopMenu,
"Vote Map",
"Map Vote",
TopMenuObject_Item,
AdminMenu_VoteMap,
voting_commands,
+2 -2
View File
@@ -26,7 +26,7 @@ DisplayBanTargetMenu(client)
new Handle:menu = CreateMenu(MenuHandler_Ban);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Vote Ban", client);
Format(title, sizeof(title), "%T:", "Ban vote", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
@@ -44,7 +44,7 @@ public AdminMenu_VoteBan(Handle:topmenu,
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Vote Ban", param);
Format(buffer, maxlength, "%T", "Ban vote", param);
}
else if (action == TopMenuAction_SelectOption)
{
+2 -2
View File
@@ -25,7 +25,7 @@ DisplayKickTargetMenu(client)
new Handle:menu = CreateMenu(MenuHandler_Kick);
decl String:title[100];
Format(title, sizeof(title), "%T:", "Vote Kick", client);
Format(title, sizeof(title), "%T:", "Kick vote", client);
SetMenuTitle(menu, title);
SetMenuExitBackButton(menu, true);
@@ -43,7 +43,7 @@ public AdminMenu_VoteKick(Handle:topmenu,
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Vote Kick", param);
Format(buffer, maxlength, "%T", "Kick vote", param);
}
else if (action == TopMenuAction_SelectOption)
{
+3 -5
View File
@@ -132,7 +132,7 @@ public AdminMenu_VoteMap(Handle:topmenu,
{
if (action == TopMenuAction_DisplayOption)
{
Format(buffer, maxlength, "%T", "Vote Map", param);
Format(buffer, maxlength, "%T", "Map vote", param);
}
else if (action == TopMenuAction_SelectOption)
{
@@ -200,7 +200,7 @@ public Action:Command_Votemap(client, args)
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))
{
@@ -228,8 +228,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)
{
@@ -298,4 +296,4 @@ LoadMapFolder(Handle:menu)
CloseHandle(mapDir);
return GetMenuItemCount(menu);
}
}