Restructured every menu to properly translate into the client's language.

This commit is contained in:
Greyscale 2009-07-27 17:02:49 -07:00
parent 70e5c93a2e
commit 5ee1395fb1
9 changed files with 112 additions and 82 deletions

View File

@ -370,16 +370,17 @@ bool:HitgroupsMenuHitgroups(client)
// Set client as translation target. // Set client as translation target.
SetGlobalTransTarget(client); SetGlobalTransTarget(client);
SetMenuTitle(menu_hitgroups, "%t\n ", "Hitgroups menu hitgroups title"); decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:enableall[MENU_LINE_REG_LENGTH]; decl String:enableall[MENU_LINE_REG_LENGTH];
decl String:headshotsonly[MENU_LINE_REG_LENGTH]; decl String:headshotsonly[MENU_LINE_REG_LENGTH];
// Format menu options. // Format menu options.
Format(title, sizeof(title), "%t\n ", "Hitgroups menu hitgroups title");
Format(enableall, sizeof(enableall), "%t", "Hitgroups menu hitgroups enable all"); Format(enableall, sizeof(enableall), "%t", "Hitgroups menu hitgroups enable all");
Format(headshotsonly, sizeof(headshotsonly), "%t\n ", "Hitgroups menu hitgroups headshots only"); Format(headshotsonly, sizeof(headshotsonly), "%t\n ", "Hitgroups menu hitgroups headshots only");
// Add options to menu. // Add options to menu.
SetMenuTitle(menu_hitgroups, title);
AddMenuItem(menu_hitgroups, "Enable All", enableall); AddMenuItem(menu_hitgroups, "Enable All", enableall);
AddMenuItem(menu_hitgroups, "Headshots Only", headshotsonly); AddMenuItem(menu_hitgroups, "Headshots Only", headshotsonly);

View File

@ -815,8 +815,7 @@ InfectMenuClients(client)
// Set client as translation target. // Set client as translation target.
SetGlobalTransTarget(client); SetGlobalTransTarget(client);
SetMenuTitle(menu_infect_clients, "%t\n ", "Infect menu clients title"); decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:clientoption[MENU_LINE_REG_LENGTH]; decl String:clientoption[MENU_LINE_REG_LENGTH];
decl String:clientuserid[8]; decl String:clientuserid[8];
@ -853,6 +852,9 @@ InfectMenuClients(client)
AddMenuItem(menu_infect_clients, clientuserid, clientoption); AddMenuItem(menu_infect_clients, clientuserid, clientoption);
} }
Format(title, sizeof(title), "%t\n ", "Infect menu clients title");
SetMenuTitle(menu_infect_clients, title);
// Create a "Back" button to the main admin menu. // Create a "Back" button to the main admin menu.
SetMenuExitBackButton(menu_infect_clients, true); SetMenuExitBackButton(menu_infect_clients, true);

View File

@ -32,6 +32,8 @@
#define MENU_LINE_REG_LENGTH 64 #define MENU_LINE_REG_LENGTH 64
#define MENU_LINE_BIG_LENGTH 128 #define MENU_LINE_BIG_LENGTH 128
#define MENU_LINE_HUGE_LENGTH 256 #define MENU_LINE_HUGE_LENGTH 256
#define MENU_LINE_TITLE_LENGTH MENU_LINE_BIG_LENGTH
/** /**
* @endsection * @endsection
*/ */
@ -78,9 +80,6 @@ ZMenuMain(client)
// Create menu handle. // Create menu handle.
new Handle:menu_main = CreateMenu(ZMenuMainHandle); new Handle:menu_main = CreateMenu(ZMenuMainHandle);
// Make client global translations target.
SetGlobalTransTarget(client);
decl String:publictrigger[4]; decl String:publictrigger[4];
decl String:silenttrigger[4]; decl String:silenttrigger[4];
@ -88,10 +87,10 @@ ZMenuMain(client)
SayHooksGetPublicChatTrigger(publictrigger, sizeof(publictrigger)); SayHooksGetPublicChatTrigger(publictrigger, sizeof(publictrigger));
SayHooksGetSilentChatTrigger(silenttrigger, sizeof(silenttrigger)); SayHooksGetSilentChatTrigger(silenttrigger, sizeof(silenttrigger));
// Set menu title. SetGlobalTransTarget(client);
SetMenuTitle(menu_main, "%t\n ", "Menu main title", publictrigger, silenttrigger);
// Initialize menu lines. // Initialize menu lines.
decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:zadmin[MENU_LINE_HUGE_LENGTH]; decl String:zadmin[MENU_LINE_HUGE_LENGTH];
decl String:zclass[MENU_LINE_HUGE_LENGTH]; decl String:zclass[MENU_LINE_HUGE_LENGTH];
decl String:zcookies[MENU_LINE_HUGE_LENGTH]; decl String:zcookies[MENU_LINE_HUGE_LENGTH];
@ -101,6 +100,7 @@ ZMenuMain(client)
decl String:zmarket[MENU_LINE_HUGE_LENGTH]; decl String:zmarket[MENU_LINE_HUGE_LENGTH];
// Translate each line into client's language. // Translate each line into client's language.
Format(title, sizeof(title), "%t\n ", "Menu main title", publictrigger, silenttrigger);
Format(zadmin, sizeof(zadmin), "%t", "Menu main zadmin", SAYHOOKS_KEYWORD_ZADMIN); Format(zadmin, sizeof(zadmin), "%t", "Menu main zadmin", SAYHOOKS_KEYWORD_ZADMIN);
Format(zclass, sizeof(zclass), "%t", "Menu main zclass", SAYHOOKS_KEYWORD_ZCLASS); Format(zclass, sizeof(zclass), "%t", "Menu main zclass", SAYHOOKS_KEYWORD_ZCLASS);
Format(zcookies, sizeof(zcookies), "%t", "Menu main zcookies", SAYHOOKS_KEYWORD_ZCOOKIES); Format(zcookies, sizeof(zcookies), "%t", "Menu main zcookies", SAYHOOKS_KEYWORD_ZCOOKIES);
@ -111,6 +111,8 @@ ZMenuMain(client)
// Add items to menu. // Add items to menu.
SetMenuTitle(menu_main, title);
// Disable option if client isn't an admin. // Disable option if client isn't an admin.
new bool:admin = ZRIsClientAdmin(client); new bool:admin = ZRIsClientAdmin(client);
AddMenuItem(menu_main, "zadmin", zadmin, MenuGetItemDraw(admin)); AddMenuItem(menu_main, "zadmin", zadmin, MenuGetItemDraw(admin));

View File

@ -45,21 +45,21 @@ ClassMenuMain(client)
SetGlobalTransTarget(client); SetGlobalTransTarget(client);
SetMenuTitle(menu, "%t\n", "Classes menu title"); SetMenuTitle(menu, "%t\n", "Classes menu title");
decl String:zombieclass[64]; decl String:zombieclass[MENU_LINE_REG_LENGTH];
decl String:humanclass[64]; decl String:humanclass[MENU_LINE_REG_LENGTH];
decl String:adminclass[64]; decl String:adminclass[MENU_LINE_REG_LENGTH];
decl String:nextzombiename[64]; decl String:nextzombiename[MENU_LINE_REG_LENGTH];
decl String:nexthumanname[64]; decl String:nexthumanname[MENU_LINE_REG_LENGTH];
decl String:nextadminname[64]; decl String:nextadminname[MENU_LINE_REG_LENGTH];
decl String:zombieselect[128]; decl String:zombieselect[MENU_LINE_BIG_LENGTH];
decl String:humanselect[128]; decl String:humanselect[MENU_LINE_BIG_LENGTH];
decl String:adminselect[128]; decl String:adminselect[MENU_LINE_BIG_LENGTH];
decl String:inadminmnode[128]; decl String:inadminmnode[MENU_LINE_BIG_LENGTH];
decl String:adminmode[128]; decl String:adminmode[MENU_LINE_BIG_LENGTH];
decl String:toggleadminmode[128]; decl String:toggleadminmode[MENU_LINE_BIG_LENGTH];
// Get number of enabled classes per team. // Get number of enabled classes per team.
new zombiecount = ClassCountTeam(ZR_CLASS_TEAM_ZOMBIES); new zombiecount = ClassCountTeam(ZR_CLASS_TEAM_ZOMBIES);
@ -81,6 +81,7 @@ ClassMenuMain(client)
if (ClassPlayerInAdminMode[client]) if (ClassPlayerInAdminMode[client])
{ {
// Notify the player. // Notify the player.
SetGlobalTransTarget(client);
Format(inadminmnode, sizeof(inadminmnode), "%t\n", "Classes admin mode enabled"); Format(inadminmnode, sizeof(inadminmnode), "%t\n", "Classes admin mode enabled");
AddMenuItem(menu, "", inadminmnode, ITEMDRAW_RAWLINE); AddMenuItem(menu, "", inadminmnode, ITEMDRAW_RAWLINE);
} }
@ -96,11 +97,14 @@ ClassMenuMain(client)
{ {
// Get name of previous class index and format item text. // Get name of previous class index and format item text.
ClassGetName(nextzombie, nextzombiename, sizeof(nextzombiename), ZR_CLASS_CACHE_MODIFIED); ClassGetName(nextzombie, nextzombiename, sizeof(nextzombiename), ZR_CLASS_CACHE_MODIFIED);
SetGlobalTransTarget(client);
Format(zombieselect, sizeof(zombieselect), "%t", "Classes menu zombie next", zombieclass, nextzombiename); Format(zombieselect, sizeof(zombieselect), "%t", "Classes menu zombie next", zombieclass, nextzombiename);
} }
else else
{ {
// Use current class name and format item text. // Use current class name and format item text.
SetGlobalTransTarget(client);
Format(zombieselect, sizeof(zombieselect), "%t", "Classes menu zombie current", zombieclass); Format(zombieselect, sizeof(zombieselect), "%t", "Classes menu zombie current", zombieclass);
} }
@ -119,11 +123,14 @@ ClassMenuMain(client)
{ {
// Get name of previous class index and format item text. // Get name of previous class index and format item text.
ClassGetName(nexthuman, nexthumanname, sizeof(nexthumanname), ZR_CLASS_CACHE_MODIFIED); ClassGetName(nexthuman, nexthumanname, sizeof(nexthumanname), ZR_CLASS_CACHE_MODIFIED);
SetGlobalTransTarget(client);
Format(humanselect, sizeof(humanselect), "%t", "Classes menu human next", humanclass, nexthumanname); Format(humanselect, sizeof(humanselect), "%t", "Classes menu human next", humanclass, nexthumanname);
} }
else else
{ {
// Use current class name and format item text. // Use current class name and format item text.
SetGlobalTransTarget(client);
Format(humanselect, sizeof(humanselect), "%t", "Classes menu human current", humanclass); Format(humanselect, sizeof(humanselect), "%t", "Classes menu human current", humanclass);
} }
@ -145,11 +152,13 @@ ClassMenuMain(client)
{ {
// Get name of previous class index and format item text. // Get name of previous class index and format item text.
ClassGetName(nextadmin, nextadminname, sizeof(nextadminname), ZR_CLASS_CACHE_MODIFIED); ClassGetName(nextadmin, nextadminname, sizeof(nextadminname), ZR_CLASS_CACHE_MODIFIED);
SetGlobalTransTarget(client);
Format(adminselect, sizeof(adminselect), "%t", "Classes menu admin next", adminclass, nextadminname); Format(adminselect, sizeof(adminselect), "%t", "Classes menu admin next", adminclass, nextadminname);
} }
else else
{ {
// Use current class name and format item text. // Use current class name and format item text.
SetGlobalTransTarget(client);
Format(adminselect, sizeof(adminselect), "%t", "Classes menu admin current", adminclass); Format(adminselect, sizeof(adminselect), "%t", "Classes menu admin current", adminclass);
} }
@ -159,10 +168,12 @@ ClassMenuMain(client)
// Set admin mode status string. // Set admin mode status string.
if (ClassPlayerInAdminMode[client]) if (ClassPlayerInAdminMode[client])
{ {
SetGlobalTransTarget(client);
Format(adminmode, sizeof(adminmode), "%t", "On"); Format(adminmode, sizeof(adminmode), "%t", "On");
} }
else else
{ {
SetGlobalTransTarget(client);
Format(adminmode, sizeof(adminmode), "%t", "Off"); Format(adminmode, sizeof(adminmode), "%t", "Off");
} }
@ -170,6 +181,7 @@ ClassMenuMain(client)
AddMenuItem(menu, "", " ", ITEMDRAW_RAWLINE); AddMenuItem(menu, "", " ", ITEMDRAW_RAWLINE);
// Show admin mode toggle option. // Show admin mode toggle option.
SetGlobalTransTarget(client);
Format(toggleadminmode, sizeof(toggleadminmode), "%t\n %s", "Classes menu admin mode toggle", adminmode); Format(toggleadminmode, sizeof(toggleadminmode), "%t\n %s", "Classes menu admin mode toggle", adminmode);
AddMenuItem(menu, "", toggleadminmode, admin_itemdraw); AddMenuItem(menu, "", toggleadminmode, admin_itemdraw);
} }
@ -242,10 +254,10 @@ ClassMenuSelect(client, teamid)
new classindex; new classindex;
new denyflags; new denyflags;
decl String:title[64]; decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:classname[64]; decl String:classname[MENU_LINE_REG_LENGTH];
decl String:description[256]; decl String:description[MENU_LINE_BIG_LENGTH];
decl String:menuitem[320]; decl String:menuitem[MENU_LINE_HUGE_LENGTH];
SetGlobalTransTarget(client); SetGlobalTransTarget(client);
@ -306,7 +318,7 @@ ClassMenuSelect(client, teamid)
*/ */
public ClassMenuSelectHandle(Handle:menu, MenuAction:action, client, slot) public ClassMenuSelectHandle(Handle:menu, MenuAction:action, client, slot)
{ {
decl String:classname[64]; decl String:classname[MENU_LINE_REG_LENGTH];
new classindex; new classindex;
new teamid; new teamid;
new bool:autoclose = GetConVarBool(g_hCvarsList[CVAR_CLASSES_MENU_AUTOCLOSE]); new bool:autoclose = GetConVarBool(g_hCvarsList[CVAR_CLASSES_MENU_AUTOCLOSE]);
@ -405,9 +417,9 @@ bool:ClassTeamSelect(client)
// Create menu. // Create menu.
new Handle:menu = CreateMenu(ClassTeamSelectHandle); new Handle:menu = CreateMenu(ClassTeamSelectHandle);
decl String:title[64]; decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:zombies[16]; decl String:zombies[MENU_LINE_SMALL_LENGTH];
decl String:humans[16]; decl String:humans[MENU_LINE_SMALL_LENGTH];
// Set translation language. // Set translation language.
SetGlobalTransTarget(client); SetGlobalTransTarget(client);
@ -486,16 +498,16 @@ ClassMultiplierSelectMenu(client)
new teamid = ClassAdminTeamSelected[client]; new teamid = ClassAdminTeamSelected[client];
new bool:zombiesselected = bool:(teamid == ZR_CLASS_TEAM_ZOMBIES); new bool:zombiesselected = bool:(teamid == ZR_CLASS_TEAM_ZOMBIES);
decl String:title[64]; decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:napalmtime[48]; decl String:napalmtime[MENU_LINE_REG_LENGTH];
decl String:health[48]; decl String:health[MENU_LINE_REG_LENGTH];
decl String:regeninterval[48]; decl String:regeninterval[MENU_LINE_REG_LENGTH];
decl String:regenamount[48]; decl String:regenamount[MENU_LINE_REG_LENGTH];
decl String:infectgain[48]; decl String:infectgain[MENU_LINE_REG_LENGTH];
decl String:speed[48]; decl String:speed[MENU_LINE_REG_LENGTH];
decl String:knockback[48]; decl String:knockback[MENU_LINE_REG_LENGTH];
decl String:jumpheight[48]; decl String:jumpheight[MENU_LINE_REG_LENGTH];
decl String:jumpdistance[48]; decl String:jumpdistance[MENU_LINE_REG_LENGTH];
new Float:currentnapalmtime; new Float:currentnapalmtime;
new Float:currenthealth; new Float:currenthealth;
@ -507,9 +519,6 @@ ClassMultiplierSelectMenu(client)
new Float:currentjumpheight; new Float:currentjumpheight;
new Float:currentjumpdistance; new Float:currentjumpdistance;
// Set translation language.
SetGlobalTransTarget(client);
// Get current multipliers. // Get current multipliers.
currentnapalmtime = Float:ClassMultiplierCache[teamid][ClassM_NapalmTime]; currentnapalmtime = Float:ClassMultiplierCache[teamid][ClassM_NapalmTime];
currenthealth = Float:ClassMultiplierCache[teamid][ClassM_Health]; currenthealth = Float:ClassMultiplierCache[teamid][ClassM_Health];
@ -521,6 +530,8 @@ ClassMultiplierSelectMenu(client)
currentjumpheight = Float:ClassMultiplierCache[teamid][ClassM_JumpHeight]; currentjumpheight = Float:ClassMultiplierCache[teamid][ClassM_JumpHeight];
currentjumpdistance = Float:ClassMultiplierCache[teamid][ClassM_JumpDistance]; currentjumpdistance = Float:ClassMultiplierCache[teamid][ClassM_JumpDistance];
SetGlobalTransTarget(client);
// Translate phrases. // Translate phrases.
Format(title, sizeof(title), "%t\n", "Classes Menu Multiplier Select Title"); Format(title, sizeof(title), "%t\n", "Classes Menu Multiplier Select Title");
Format(health, sizeof(health), "%t\n %.2f", "Classes Attrib Health", currenthealth); Format(health, sizeof(health), "%t\n %.2f", "Classes Attrib Health", currenthealth);
@ -645,19 +656,18 @@ ClassMultiplierMenu(client, ClassMultipliers:attribute)
new Handle:menu = CreateMenu(ClassMultiplierHandle); new Handle:menu = CreateMenu(ClassMultiplierHandle);
decl String:title[64]; decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:attributename[48]; decl String:attributename[MENU_LINE_REG_LENGTH];
decl String:linebuffer[48]; decl String:linebuffer[MENU_LINE_REG_LENGTH];
// Set translation language.
SetGlobalTransTarget(client);
// Get attribute string. // Get attribute string.
ClassMultiplierToString(attribute, attributename, sizeof(attributename)); ClassMultiplierToString(client, attribute, attributename, sizeof(attributename));
SetGlobalTransTarget(client);
Format(title, sizeof(title), "%t %s\n%t %.2f\n", "Classes Menu Adjust Value", attributename, "Current Value", Float:ClassMultiplierCache[ClassAdminTeamSelected[client]][attribute]); Format(title, sizeof(title), "%t %s\n%t %.2f\n", "Classes Menu Adjust Value", attributename, "Current Value", Float:ClassMultiplierCache[ClassAdminTeamSelected[client]][attribute]);
SetMenuTitle(menu, title); SetMenuTitle(menu, title);
SetGlobalTransTarget(client);
Format(linebuffer, sizeof(linebuffer), "%t", "Increase by", "0.5"); Format(linebuffer, sizeof(linebuffer), "%t", "Increase by", "0.5");
AddMenuItem(menu, "increasehalf", linebuffer); AddMenuItem(menu, "increasehalf", linebuffer);
Format(linebuffer, sizeof(linebuffer), "%t", "Increase by", "0.1"); Format(linebuffer, sizeof(linebuffer), "%t", "Increase by", "0.1");

View File

@ -1055,15 +1055,17 @@ ClassDumpData(index, cachetype, String:buffer[], maxlen)
/** /**
* Converts a multiplier attribute to a human readable string. * Converts a multiplier attribute to a human readable string.
* *
* @param client The client index to translate correct language.
* @param attribute Attribute to convert. * @param attribute Attribute to convert.
* @param buffer Destination string buffer. * @param buffer Destination string buffer.
* @param maxlen Size of buffer. * @param maxlen Size of buffer.
* @return Number of cells written. * @return Number of cells written.
*/ */
ClassMultiplierToString(ClassMultipliers:attribute, String:buffer[], maxlen) ClassMultiplierToString(client, ClassMultipliers:attribute, String:buffer[], maxlen)
{ {
decl String:phrase[48]; decl String:phrase[48];
SetGlobalTransTarget(client);
switch (attribute) switch (attribute)
{ {
case ClassM_NapalmTime: case ClassM_NapalmTime:

View File

@ -49,15 +49,16 @@ bool:WeaponsMenuMain(client)
SetGlobalTransTarget(client); SetGlobalTransTarget(client);
SetMenuTitle(menu_weapons_main, "%t\n ", "Weapons menu restrict main title"); decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:restrict[MENU_LINE_SMALL_LENGTH]; decl String:restrict[MENU_LINE_SMALL_LENGTH];
decl String:zmarket[MENU_LINE_SMALL_LENGTH]; decl String:zmarket[MENU_LINE_SMALL_LENGTH];
Format(title, sizeof(title), "%t\n ", "Weapons menu restrict main title");
Format(restrict, sizeof(restrict), "%t", "Weapons menu restrict main restrict"); Format(restrict, sizeof(restrict), "%t", "Weapons menu restrict main restrict");
Format(zmarket, sizeof(zmarket), "%t", "Weapons menu restrict main market"); Format(zmarket, sizeof(zmarket), "%t", "Weapons menu restrict main market");
// Draw items, make unselectable if module is disabled. // Draw items, make unselectable if module is disabled.
SetMenuTitle(menu_weapons_main, title);
AddMenuItem(menu_weapons_main, "restrict", restrict, MenuGetItemDraw(GetConVarBool(g_hCvarsList[CVAR_WEAPONS_RESTRICT]))); AddMenuItem(menu_weapons_main, "restrict", restrict, MenuGetItemDraw(GetConVarBool(g_hCvarsList[CVAR_WEAPONS_RESTRICT])));
AddMenuItem(menu_weapons_main, "zmarket", zmarket, MenuGetItemDraw(GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET]))); AddMenuItem(menu_weapons_main, "zmarket", zmarket, MenuGetItemDraw(GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET])));
@ -126,7 +127,9 @@ WeaponsMenuTypes(client)
SetGlobalTransTarget(client); SetGlobalTransTarget(client);
SetMenuTitle(menu_weapons_types, "%t\n ", "Weapons menu restrict types title"); decl String:title[MENU_LINE_TITLE_LENGTH];
Format(title, sizeof(title), "%t\n ", "Weapons menu restrict types title");
SetMenuTitle(menu_weapons_types, title);
decl String:typename[WEAPONS_MAX_LENGTH]; decl String:typename[WEAPONS_MAX_LENGTH];
@ -144,6 +147,8 @@ WeaponsMenuTypes(client)
// If there are no weapons, add an "(Empty)" line. // If there are no weapons, add an "(Empty)" line.
if (size == 0) if (size == 0)
{ {
SetGlobalTransTarget(client);
decl String:empty[MENU_LINE_SMALL_LENGTH]; decl String:empty[MENU_LINE_SMALL_LENGTH];
Format(empty, sizeof(empty), "%t", "Menu empty"); Format(empty, sizeof(empty), "%t", "Menu empty");
@ -204,15 +209,16 @@ WeaponsMenuTypeWeapons(client)
decl String:typename[WEAPONS_MAX_LENGTH]; decl String:typename[WEAPONS_MAX_LENGTH];
RestrictWeaponTypeGetName(g_iWeaponsCurType[client], typename, sizeof(typename)); RestrictWeaponTypeGetName(g_iWeaponsCurType[client], typename, sizeof(typename));
SetMenuTitle(menu_weapons_typeweapons, "%t\n ", "Weapons menu restrict types weapon type title", typename); decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:restrictall[MENU_LINE_REG_LENGTH]; decl String:restrictall[MENU_LINE_REG_LENGTH];
decl String:unrestrictall[MENU_LINE_REG_LENGTH]; decl String:unrestrictall[MENU_LINE_REG_LENGTH];
Format(title, sizeof(title), "%t\n ", "Weapons menu restrict types weapon type title", typename);
Format(restrictall, sizeof(restrictall), "%t", "Weapons menu restrict types restrict all", typename); Format(restrictall, sizeof(restrictall), "%t", "Weapons menu restrict types restrict all", typename);
Format(unrestrictall, sizeof(unrestrictall), "%t\n ", "Weapons menu restrict types unrestrict all", typename); Format(unrestrictall, sizeof(unrestrictall), "%t\n ", "Weapons menu restrict types unrestrict all", typename);
// Draw items as selectable only if not all weapons within the type are restricted or unrestricted. // Draw items as selectable only if not all weapons within the type are restricted or unrestricted.
SetMenuTitle(menu_weapons_typeweapons, title);
AddMenuItem(menu_weapons_typeweapons, "restrictall", restrictall, MenuGetItemDraw(!RestrictIsTypeUniform(true, g_iWeaponsCurType[client]))); AddMenuItem(menu_weapons_typeweapons, "restrictall", restrictall, MenuGetItemDraw(!RestrictIsTypeUniform(true, g_iWeaponsCurType[client])));
AddMenuItem(menu_weapons_typeweapons, "unrestrictall", unrestrictall, MenuGetItemDraw(!RestrictIsTypeUniform(false, g_iWeaponsCurType[client]))); AddMenuItem(menu_weapons_typeweapons, "unrestrictall", unrestrictall, MenuGetItemDraw(!RestrictIsTypeUniform(false, g_iWeaponsCurType[client])));
@ -352,18 +358,20 @@ WeaponsMenuZMarket(client)
// Create menu handle. // Create menu handle.
new Handle:menu_weapons_market = CreateMenu(WeaponsMenuZMarketHandle); new Handle:menu_weapons_market = CreateMenu(WeaponsMenuZMarketHandle);
SetGlobalTransTarget(client);
SetMenuTitle(menu_weapons_market, "%t\n ", "Weapons menu restrict zmarket title");
decl String:buyzone[MENU_LINE_REG_LENGTH];
decl String:buyzonesetting[8];
// Get "yes" or "no" settings from respective cvar. // Get "yes" or "no" settings from respective cvar.
decl String:buyzonesetting[8];
ConfigBoolToSetting(GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE]), buyzonesetting, sizeof(buyzonesetting)); ConfigBoolToSetting(GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_BUYZONE]), buyzonesetting, sizeof(buyzonesetting));
SetGlobalTransTarget(client);
decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:buyzone[MENU_LINE_REG_LENGTH];
// Add options to menu. // Add options to menu.
Format(title, sizeof(title), "%t\n ", "Weapons menu restrict zmarket title");
Format(buyzone, sizeof(buyzone), "%t", "Weapons menu restrict zmarket buyzone", buyzonesetting); Format(buyzone, sizeof(buyzone), "%t", "Weapons menu restrict zmarket buyzone", buyzonesetting);
SetMenuTitle(menu_weapons_market, title);
AddMenuItem(menu_weapons_market, "buyzone", buyzone); AddMenuItem(menu_weapons_market, "buyzone", buyzone);
// Create a "Back" button to the weapons main menu. // Create a "Back" button to the weapons main menu.

View File

@ -250,14 +250,12 @@ bool:ZMarketMenuMain(client)
// Set translation target as client. // Set translation target as client.
SetGlobalTransTarget(client); SetGlobalTransTarget(client);
// Set menu title.
SetMenuTitle(menu_zmarket_main, "%t\n ", "Weapons menu zmarket main title");
// If rebuy is enabled, then add it to the menu. // If rebuy is enabled, then add it to the menu.
new bool:zmarketrebuy = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_REBUY]); new bool:zmarketrebuy = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_REBUY]);
new bool:zmarketrebuyauto = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_REBUY_AUTO]); new bool:zmarketrebuyauto = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_REBUY_AUTO]);
// Add "Get Current Loadout" option. // Add "Get Current Loadout" option.
decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:getloadout[MENU_LINE_REG_LENGTH]; decl String:getloadout[MENU_LINE_REG_LENGTH];
decl String:viewloadout[MENU_LINE_REG_LENGTH]; decl String:viewloadout[MENU_LINE_REG_LENGTH];
decl String:rebuy[MENU_LINE_REG_LENGTH]; decl String:rebuy[MENU_LINE_REG_LENGTH];
@ -269,6 +267,7 @@ bool:ZMarketMenuMain(client)
ConfigBoolToSetting(CookiesGetClientCookieBool(client, g_hZMarketAutoRebuyCookie), rebuyautosetting, sizeof(rebuyautosetting)); ConfigBoolToSetting(CookiesGetClientCookieBool(client, g_hZMarketAutoRebuyCookie), rebuyautosetting, sizeof(rebuyautosetting));
// Format menu options. // Format menu options.
Format(title, sizeof(title), "%t\n ", "Weapons menu zmarket main title");
Format(getloadout, sizeof(getloadout), "%t", "Weapons menu zmarket main get loadout"); Format(getloadout, sizeof(getloadout), "%t", "Weapons menu zmarket main get loadout");
Format(viewloadout, sizeof(viewloadout), "%t", "Weapons menu zmarket main view loadout"); Format(viewloadout, sizeof(viewloadout), "%t", "Weapons menu zmarket main view loadout");
Format(rebuy, sizeof(rebuy), "%t", "Weapons menu zmarket main rebuy"); Format(rebuy, sizeof(rebuy), "%t", "Weapons menu zmarket main rebuy");
@ -276,6 +275,7 @@ bool:ZMarketMenuMain(client)
Format(weaponslist, sizeof(weaponslist), "%t", "Weapons menu zmarket main weapons list"); Format(weaponslist, sizeof(weaponslist), "%t", "Weapons menu zmarket main weapons list");
// Add formatted options to menu. // Add formatted options to menu.
SetMenuTitle(menu_zmarket_main, title);
AddMenuItem(menu_zmarket_main, "Get Loadout", getloadout, MenuGetItemDraw(zmarketrebuy || zmarketrebuyauto)); AddMenuItem(menu_zmarket_main, "Get Loadout", getloadout, MenuGetItemDraw(zmarketrebuy || zmarketrebuyauto));
AddMenuItem(menu_zmarket_main, "View Loadout", viewloadout, MenuGetItemDraw(zmarketrebuy || zmarketrebuyauto)); AddMenuItem(menu_zmarket_main, "View Loadout", viewloadout, MenuGetItemDraw(zmarketrebuy || zmarketrebuyauto));
AddMenuItem(menu_zmarket_main, "Rebuy", rebuy, MenuGetItemDraw(zmarketrebuy || zmarketrebuyauto)); AddMenuItem(menu_zmarket_main, "Rebuy", rebuy, MenuGetItemDraw(zmarketrebuy || zmarketrebuyauto));
@ -373,12 +373,6 @@ bool:ZMarketMenuLoadout(client)
// Create menu handle. // Create menu handle.
new Handle:menu_zmarket_loadout = CreateMenu(ZMarketMenuLoadoutHandle); new Handle:menu_zmarket_loadout = CreateMenu(ZMarketMenuLoadoutHandle);
// Set translation target as client.
SetGlobalTransTarget(client);
// Set menu title.
SetMenuTitle(menu_zmarket_loadout, "%t\n ", "Weapons menu zmarket loadout title");
decl String:primaryweapon[WEAPONS_MAX_LENGTH]; decl String:primaryweapon[WEAPONS_MAX_LENGTH];
decl String:secondaryweapon[WEAPONS_MAX_LENGTH]; decl String:secondaryweapon[WEAPONS_MAX_LENGTH];
decl String:meleeweapon[WEAPONS_MAX_LENGTH]; decl String:meleeweapon[WEAPONS_MAX_LENGTH];
@ -398,6 +392,8 @@ bool:ZMarketMenuLoadout(client)
WeaponsClassnameToDisplay(rebuyweapons[Slot_Explosive], sizeof(rebuyweapons[]), explosiveweapon, sizeof(explosiveweapon)); WeaponsClassnameToDisplay(rebuyweapons[Slot_Explosive], sizeof(rebuyweapons[]), explosiveweapon, sizeof(explosiveweapon));
WeaponsClassnameToDisplay(rebuyweapons[Slot_NVGs], sizeof(rebuyweapons[]), nvgsweapon, sizeof(nvgsweapon)); WeaponsClassnameToDisplay(rebuyweapons[Slot_NVGs], sizeof(rebuyweapons[]), nvgsweapon, sizeof(nvgsweapon));
SetGlobalTransTarget(client);
// Get the empty translation. // Get the empty translation.
decl String:empty[MENU_LINE_SMALL_LENGTH]; decl String:empty[MENU_LINE_SMALL_LENGTH];
Format(empty, sizeof(empty), "%t", "Weapons menu zmarket loadout empty"); Format(empty, sizeof(empty), "%t", "Weapons menu zmarket loadout empty");
@ -428,6 +424,7 @@ bool:ZMarketMenuLoadout(client)
decl String:nvgsbool[8]; decl String:nvgsbool[8];
ConfigBoolToSetting(bool:nvgsweapon[0], nvgsbool, sizeof(nvgsbool)); ConfigBoolToSetting(bool:nvgsweapon[0], nvgsbool, sizeof(nvgsbool));
decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:primary[MENU_LINE_REG_LENGTH]; decl String:primary[MENU_LINE_REG_LENGTH];
decl String:secondary[MENU_LINE_REG_LENGTH]; decl String:secondary[MENU_LINE_REG_LENGTH];
decl String:melee[MENU_LINE_REG_LENGTH]; decl String:melee[MENU_LINE_REG_LENGTH];
@ -436,6 +433,7 @@ bool:ZMarketMenuLoadout(client)
decl String:nvgs[MENU_LINE_REG_LENGTH]; decl String:nvgs[MENU_LINE_REG_LENGTH];
// Format all the lines of the menu. // Format all the lines of the menu.
Format(title, sizeof(title), "%t\n ", "Weapons menu zmarket loadout title");
Format(primary, sizeof(primary), "%t", "Weapons menu zmarket loadout primary", primaryweapon); Format(primary, sizeof(primary), "%t", "Weapons menu zmarket loadout primary", primaryweapon);
Format(secondary, sizeof(secondary), "%t", "Weapons menu zmarket loadout secondary", secondaryweapon); Format(secondary, sizeof(secondary), "%t", "Weapons menu zmarket loadout secondary", secondaryweapon);
Format(melee, sizeof(melee), "%t", "Weapons menu zmarket loadout melee", meleeweapon); Format(melee, sizeof(melee), "%t", "Weapons menu zmarket loadout melee", meleeweapon);
@ -444,6 +442,7 @@ bool:ZMarketMenuLoadout(client)
Format(nvgs, sizeof(nvgs), "%t", "Weapons menu zmarket loadout nvgs", nvgsbool); Format(nvgs, sizeof(nvgs), "%t", "Weapons menu zmarket loadout nvgs", nvgsbool);
// Add formatted options to menu. // Add formatted options to menu.
SetMenuTitle(menu_zmarket_loadout, title);
AddMenuItem(menu_zmarket_loadout, "0", primary, MenuGetItemDraw(!StrEqual(primaryweapon, empty))); AddMenuItem(menu_zmarket_loadout, "0", primary, MenuGetItemDraw(!StrEqual(primaryweapon, empty)));
AddMenuItem(menu_zmarket_loadout, "1", secondary, MenuGetItemDraw(!StrEqual(secondaryweapon, empty))); AddMenuItem(menu_zmarket_loadout, "1", secondary, MenuGetItemDraw(!StrEqual(secondaryweapon, empty)));
AddMenuItem(menu_zmarket_loadout, "2", melee, MenuGetItemDraw(!StrEqual(meleeweapon, empty))); AddMenuItem(menu_zmarket_loadout, "2", melee, MenuGetItemDraw(!StrEqual(meleeweapon, empty)));
@ -504,10 +503,10 @@ ZMarketMenuTypes(client)
new Handle:menu_zmarket_types = CreateMenu(ZMarketMenuTypesHandle); new Handle:menu_zmarket_types = CreateMenu(ZMarketMenuTypesHandle);
// Set translation target as client. // Set translation target as client.
SetGlobalTransTarget(client);
// Set menu title. decl String:title[MENU_LINE_TITLE_LENGTH];
SetMenuTitle(menu_zmarket_types, "%t\n ", "Weapons menu zmarket types title"); Format(title, sizeof(title), "%t\n ", "Weapons menu zmarket types title");
SetMenuTitle(menu_zmarket_types, title);
decl String:typename[WEAPONS_MAX_LENGTH]; decl String:typename[WEAPONS_MAX_LENGTH];
@ -525,6 +524,8 @@ ZMarketMenuTypes(client)
// If there are no weapons, add an "(Empty)" line. // If there are no weapons, add an "(Empty)" line.
if (size == 0) if (size == 0)
{ {
SetGlobalTransTarget(client);
decl String:empty[MENU_LINE_SMALL_LENGTH]; decl String:empty[MENU_LINE_SMALL_LENGTH];
Format(empty, sizeof(empty), "%t", "Menu empty"); Format(empty, sizeof(empty), "%t", "Menu empty");
@ -601,9 +602,7 @@ ZMarketMenuTypeWeapons(client)
decl String:typename[WEAPONS_MAX_LENGTH]; decl String:typename[WEAPONS_MAX_LENGTH];
RestrictWeaponTypeGetName(g_iZMarketCurType[client], typename, sizeof(typename)); RestrictWeaponTypeGetName(g_iZMarketCurType[client], typename, sizeof(typename));
// Set menu title. decl String:title[MENU_LINE_TITLE_LENGTH];
SetMenuTitle(menu_zmarket_typeweapons, "%t\n ", "Weapons menu zmarket types weapon type title", typename);
decl String:typeweapon[WEAPONS_MAX_LENGTH]; decl String:typeweapon[WEAPONS_MAX_LENGTH];
decl String:typeweapondisplay[MENU_LINE_REG_LENGTH]; decl String:typeweapondisplay[MENU_LINE_REG_LENGTH];
decl String:display[MENU_LINE_BIG_LENGTH]; decl String:display[MENU_LINE_BIG_LENGTH];
@ -612,6 +611,8 @@ ZMarketMenuTypeWeapons(client)
new Handle:arrayTypeWeapons; new Handle:arrayTypeWeapons;
new count = RestrictGetTypeWeapons(g_iZMarketCurType[client], arrayTypeWeapons); new count = RestrictGetTypeWeapons(g_iZMarketCurType[client], arrayTypeWeapons);
SetGlobalTransTarget(client);
// x = Array index. // x = Array index.
for (new x = 0; x < count; x++) for (new x = 0; x < count; x++)
{ {
@ -695,6 +696,9 @@ ZMarketMenuTypeWeapons(client)
AddMenuItem(menu_zmarket_typeweapons, typeweapon, display, MenuGetItemDraw(itemdraw)); AddMenuItem(menu_zmarket_typeweapons, typeweapon, display, MenuGetItemDraw(itemdraw));
} }
Format(title, sizeof(title), "%t\n ", "Weapons menu zmarket types weapon type title", typename);
SetMenuTitle(menu_zmarket_typeweapons, title);
// Destroy the array handle. // Destroy the array handle.
CloseHandle(arrayTypeWeapons); CloseHandle(arrayTypeWeapons);

View File

@ -77,8 +77,7 @@ bool:ZAdminMenu(client)
// Set translation target as the client. // Set translation target as the client.
SetGlobalTransTarget(client); SetGlobalTransTarget(client);
SetMenuTitle(menu_zadmin, "%t\n ", "ZAdmin main title"); decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:classmultipliers[MENU_LINE_REG_LENGTH]; decl String:classmultipliers[MENU_LINE_REG_LENGTH];
decl String:weapons[MENU_LINE_REG_LENGTH]; decl String:weapons[MENU_LINE_REG_LENGTH];
decl String:hitgroups[MENU_LINE_REG_LENGTH]; decl String:hitgroups[MENU_LINE_REG_LENGTH];
@ -86,6 +85,7 @@ bool:ZAdminMenu(client)
decl String:zspawn[MENU_LINE_REG_LENGTH]; decl String:zspawn[MENU_LINE_REG_LENGTH];
decl String:ztele[MENU_LINE_REG_LENGTH]; decl String:ztele[MENU_LINE_REG_LENGTH];
Format(title, sizeof(title), "%t\n ", "ZAdmin main title");
Format(classmultipliers, sizeof(classmultipliers), "%t", "ZAdmin main class multipliers"); Format(classmultipliers, sizeof(classmultipliers), "%t", "ZAdmin main class multipliers");
Format(weapons, sizeof(weapons), "%t", "ZAdmin main weapons"); Format(weapons, sizeof(weapons), "%t", "ZAdmin main weapons");
Format(hitgroups, sizeof(hitgroups), "%t", "ZAdmin main hitgroups"); Format(hitgroups, sizeof(hitgroups), "%t", "ZAdmin main hitgroups");
@ -97,6 +97,7 @@ bool:ZAdminMenu(client)
new bool:hitgroupsenabled = GetConVarBool(g_hCvarsList[CVAR_HITGROUPS]); new bool:hitgroupsenabled = GetConVarBool(g_hCvarsList[CVAR_HITGROUPS]);
// Add items to menu. // Add items to menu.
SetMenuTitle(menu_zadmin, title);
AddMenuItem(menu_zadmin, "classmultipliers", classmultipliers); AddMenuItem(menu_zadmin, "classmultipliers", classmultipliers);
AddMenuItem(menu_zadmin, "weapons", weapons); AddMenuItem(menu_zadmin, "weapons", weapons);
AddMenuItem(menu_zadmin, "hitgroups", hitgroups, MenuGetItemDraw(hitgroupsenabled)); AddMenuItem(menu_zadmin, "hitgroups", hitgroups, MenuGetItemDraw(hitgroupsenabled));

View File

@ -47,9 +47,6 @@ ZCookiesMenuMain(client)
// Make client global translations target. // Make client global translations target.
SetGlobalTransTarget(client); SetGlobalTransTarget(client);
// Set menu title.
SetMenuTitle(zcookies_menu_main, "%t\n ", "ZCookies Menu main title");
decl String:autorebuyenabled[4]; decl String:autorebuyenabled[4];
decl String:zhpenabled[4]; decl String:zhpenabled[4];
decl String:overlayenabled[4]; decl String:overlayenabled[4];
@ -59,12 +56,14 @@ ZCookiesMenuMain(client)
ConfigBoolToSetting(CookiesGetClientCookieBool(client, g_hZHPEnabledCookie), zhpenabled, sizeof(zhpenabled), false); ConfigBoolToSetting(CookiesGetClientCookieBool(client, g_hZHPEnabledCookie), zhpenabled, sizeof(zhpenabled), false);
ConfigBoolToSetting(CookiesGetClientCookieBool(client, g_hOverlayEnabledCookie), overlayenabled, sizeof(overlayenabled), false); ConfigBoolToSetting(CookiesGetClientCookieBool(client, g_hOverlayEnabledCookie), overlayenabled, sizeof(overlayenabled), false);
decl String:title[MENU_LINE_TITLE_LENGTH];
decl String:autorebuy[MENU_LINE_REG_LENGTH]; decl String:autorebuy[MENU_LINE_REG_LENGTH];
decl String:zhp[MENU_LINE_REG_LENGTH]; decl String:zhp[MENU_LINE_REG_LENGTH];
decl String:overlay[MENU_LINE_REG_LENGTH]; decl String:overlay[MENU_LINE_REG_LENGTH];
decl String:zmarket[MENU_LINE_REG_LENGTH]; decl String:zmarket[MENU_LINE_REG_LENGTH];
// Translate each line into client's language. // Translate each line into client's language.
Format(title, sizeof(title), "%t\n ", "ZCookies Menu main title");
Format(autorebuy, sizeof(autorebuy), "%t", "ZCookies menu main auto-rebuy", autorebuyenabled); Format(autorebuy, sizeof(autorebuy), "%t", "ZCookies menu main auto-rebuy", autorebuyenabled);
Format(zhp, sizeof(zhp), "%t", "ZCookies menu main zhp", zhpenabled); Format(zhp, sizeof(zhp), "%t", "ZCookies menu main zhp", zhpenabled);
Format(overlay, sizeof(overlay), "%t", "ZCookies menu main overlay", overlayenabled); Format(overlay, sizeof(overlay), "%t", "ZCookies menu main overlay", overlayenabled);
@ -78,6 +77,7 @@ ZCookiesMenuMain(client)
new bool:zmarketenabled = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET]); // For ZMarket loadout. new bool:zmarketenabled = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET]); // For ZMarket loadout.
// Add items to menu. // Add items to menu.
SetMenuTitle(zcookies_menu_main, title);
AddMenuItem(zcookies_menu_main, "autorebuy", autorebuy, MenuGetItemDraw(weapons && zmarketrebuyauto)); AddMenuItem(zcookies_menu_main, "autorebuy", autorebuy, MenuGetItemDraw(weapons && zmarketrebuyauto));
AddMenuItem(zcookies_menu_main, "zhp", zhp, MenuGetItemDraw(zhpcvar)); AddMenuItem(zcookies_menu_main, "zhp", zhp, MenuGetItemDraw(zhpcvar));
AddMenuItem(zcookies_menu_main, "overlay", overlay, MenuGetItemDraw(overlaytoggle)); AddMenuItem(zcookies_menu_main, "overlay", overlay, MenuGetItemDraw(overlaytoggle));