From 5ee1395fb1c220cc8c3e8c2acc76808b03223b29 Mon Sep 17 00:00:00 2001 From: Greyscale Date: Mon, 27 Jul 2009 17:02:49 -0700 Subject: [PATCH] Restructured every menu to properly translate into the client's language. --- src/zr/hitgroups.inc | 5 +- src/zr/infect.inc | 6 +- src/zr/menu.inc | 12 ++-- src/zr/playerclasses/classmenus.inc | 90 ++++++++++++++------------ src/zr/playerclasses/playerclasses.inc | 4 +- src/zr/weapons/menu_weapons.inc | 32 +++++---- src/zr/weapons/zmarket.inc | 34 +++++----- src/zr/zadmin.inc | 5 +- src/zr/zcookies.inc | 6 +- 9 files changed, 112 insertions(+), 82 deletions(-) diff --git a/src/zr/hitgroups.inc b/src/zr/hitgroups.inc index 20c04ce..0cd330e 100644 --- a/src/zr/hitgroups.inc +++ b/src/zr/hitgroups.inc @@ -370,16 +370,17 @@ bool:HitgroupsMenuHitgroups(client) // Set client as translation target. 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:headshotsonly[MENU_LINE_REG_LENGTH]; // Format menu options. + Format(title, sizeof(title), "%t\n ", "Hitgroups menu hitgroups title"); Format(enableall, sizeof(enableall), "%t", "Hitgroups menu hitgroups enable all"); Format(headshotsonly, sizeof(headshotsonly), "%t\n ", "Hitgroups menu hitgroups headshots only"); // Add options to menu. + SetMenuTitle(menu_hitgroups, title); AddMenuItem(menu_hitgroups, "Enable All", enableall); AddMenuItem(menu_hitgroups, "Headshots Only", headshotsonly); diff --git a/src/zr/infect.inc b/src/zr/infect.inc index 5d627a8..4096877 100644 --- a/src/zr/infect.inc +++ b/src/zr/infect.inc @@ -815,8 +815,7 @@ InfectMenuClients(client) // Set client as translation target. 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:clientuserid[8]; @@ -853,6 +852,9 @@ InfectMenuClients(client) 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. SetMenuExitBackButton(menu_infect_clients, true); diff --git a/src/zr/menu.inc b/src/zr/menu.inc index e51c1d6..4585af7 100644 --- a/src/zr/menu.inc +++ b/src/zr/menu.inc @@ -32,6 +32,8 @@ #define MENU_LINE_REG_LENGTH 64 #define MENU_LINE_BIG_LENGTH 128 #define MENU_LINE_HUGE_LENGTH 256 + +#define MENU_LINE_TITLE_LENGTH MENU_LINE_BIG_LENGTH /** * @endsection */ @@ -78,9 +80,6 @@ ZMenuMain(client) // Create menu handle. new Handle:menu_main = CreateMenu(ZMenuMainHandle); - // Make client global translations target. - SetGlobalTransTarget(client); - decl String:publictrigger[4]; decl String:silenttrigger[4]; @@ -88,10 +87,10 @@ ZMenuMain(client) SayHooksGetPublicChatTrigger(publictrigger, sizeof(publictrigger)); SayHooksGetSilentChatTrigger(silenttrigger, sizeof(silenttrigger)); - // Set menu title. - SetMenuTitle(menu_main, "%t\n ", "Menu main title", publictrigger, silenttrigger); + SetGlobalTransTarget(client); // Initialize menu lines. + decl String:title[MENU_LINE_TITLE_LENGTH]; decl String:zadmin[MENU_LINE_HUGE_LENGTH]; decl String:zclass[MENU_LINE_HUGE_LENGTH]; decl String:zcookies[MENU_LINE_HUGE_LENGTH]; @@ -101,6 +100,7 @@ ZMenuMain(client) decl String:zmarket[MENU_LINE_HUGE_LENGTH]; // 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(zclass, sizeof(zclass), "%t", "Menu main zclass", SAYHOOKS_KEYWORD_ZCLASS); Format(zcookies, sizeof(zcookies), "%t", "Menu main zcookies", SAYHOOKS_KEYWORD_ZCOOKIES); @@ -111,6 +111,8 @@ ZMenuMain(client) // Add items to menu. + SetMenuTitle(menu_main, title); + // Disable option if client isn't an admin. new bool:admin = ZRIsClientAdmin(client); AddMenuItem(menu_main, "zadmin", zadmin, MenuGetItemDraw(admin)); diff --git a/src/zr/playerclasses/classmenus.inc b/src/zr/playerclasses/classmenus.inc index 6df326f..c6414e7 100644 --- a/src/zr/playerclasses/classmenus.inc +++ b/src/zr/playerclasses/classmenus.inc @@ -45,21 +45,21 @@ ClassMenuMain(client) SetGlobalTransTarget(client); SetMenuTitle(menu, "%t\n", "Classes menu title"); - decl String:zombieclass[64]; - decl String:humanclass[64]; - decl String:adminclass[64]; + decl String:zombieclass[MENU_LINE_REG_LENGTH]; + decl String:humanclass[MENU_LINE_REG_LENGTH]; + decl String:adminclass[MENU_LINE_REG_LENGTH]; - decl String:nextzombiename[64]; - decl String:nexthumanname[64]; - decl String:nextadminname[64]; + decl String:nextzombiename[MENU_LINE_REG_LENGTH]; + decl String:nexthumanname[MENU_LINE_REG_LENGTH]; + decl String:nextadminname[MENU_LINE_REG_LENGTH]; - decl String:zombieselect[128]; - decl String:humanselect[128]; - decl String:adminselect[128]; + decl String:zombieselect[MENU_LINE_BIG_LENGTH]; + decl String:humanselect[MENU_LINE_BIG_LENGTH]; + decl String:adminselect[MENU_LINE_BIG_LENGTH]; - decl String:inadminmnode[128]; - decl String:adminmode[128]; - decl String:toggleadminmode[128]; + decl String:inadminmnode[MENU_LINE_BIG_LENGTH]; + decl String:adminmode[MENU_LINE_BIG_LENGTH]; + decl String:toggleadminmode[MENU_LINE_BIG_LENGTH]; // Get number of enabled classes per team. new zombiecount = ClassCountTeam(ZR_CLASS_TEAM_ZOMBIES); @@ -81,6 +81,7 @@ ClassMenuMain(client) if (ClassPlayerInAdminMode[client]) { // Notify the player. + SetGlobalTransTarget(client); Format(inadminmnode, sizeof(inadminmnode), "%t\n", "Classes admin mode enabled"); AddMenuItem(menu, "", inadminmnode, ITEMDRAW_RAWLINE); } @@ -96,11 +97,14 @@ ClassMenuMain(client) { // Get name of previous class index and format item text. ClassGetName(nextzombie, nextzombiename, sizeof(nextzombiename), ZR_CLASS_CACHE_MODIFIED); + + SetGlobalTransTarget(client); Format(zombieselect, sizeof(zombieselect), "%t", "Classes menu zombie next", zombieclass, nextzombiename); } else { // Use current class name and format item text. + SetGlobalTransTarget(client); 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. ClassGetName(nexthuman, nexthumanname, sizeof(nexthumanname), ZR_CLASS_CACHE_MODIFIED); + + SetGlobalTransTarget(client); Format(humanselect, sizeof(humanselect), "%t", "Classes menu human next", humanclass, nexthumanname); } else { // Use current class name and format item text. + SetGlobalTransTarget(client); 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. ClassGetName(nextadmin, nextadminname, sizeof(nextadminname), ZR_CLASS_CACHE_MODIFIED); + SetGlobalTransTarget(client); Format(adminselect, sizeof(adminselect), "%t", "Classes menu admin next", adminclass, nextadminname); } else { // Use current class name and format item text. + SetGlobalTransTarget(client); Format(adminselect, sizeof(adminselect), "%t", "Classes menu admin current", adminclass); } @@ -159,10 +168,12 @@ ClassMenuMain(client) // Set admin mode status string. if (ClassPlayerInAdminMode[client]) { + SetGlobalTransTarget(client); Format(adminmode, sizeof(adminmode), "%t", "On"); } else { + SetGlobalTransTarget(client); Format(adminmode, sizeof(adminmode), "%t", "Off"); } @@ -170,6 +181,7 @@ ClassMenuMain(client) AddMenuItem(menu, "", " ", ITEMDRAW_RAWLINE); // Show admin mode toggle option. + SetGlobalTransTarget(client); Format(toggleadminmode, sizeof(toggleadminmode), "%t\n %s", "Classes menu admin mode toggle", adminmode); AddMenuItem(menu, "", toggleadminmode, admin_itemdraw); } @@ -242,10 +254,10 @@ ClassMenuSelect(client, teamid) new classindex; new denyflags; - decl String:title[64]; - decl String:classname[64]; - decl String:description[256]; - decl String:menuitem[320]; + decl String:title[MENU_LINE_TITLE_LENGTH]; + decl String:classname[MENU_LINE_REG_LENGTH]; + decl String:description[MENU_LINE_BIG_LENGTH]; + decl String:menuitem[MENU_LINE_HUGE_LENGTH]; SetGlobalTransTarget(client); @@ -306,7 +318,7 @@ ClassMenuSelect(client, teamid) */ public ClassMenuSelectHandle(Handle:menu, MenuAction:action, client, slot) { - decl String:classname[64]; + decl String:classname[MENU_LINE_REG_LENGTH]; new classindex; new teamid; new bool:autoclose = GetConVarBool(g_hCvarsList[CVAR_CLASSES_MENU_AUTOCLOSE]); @@ -405,9 +417,9 @@ bool:ClassTeamSelect(client) // Create menu. new Handle:menu = CreateMenu(ClassTeamSelectHandle); - decl String:title[64]; - decl String:zombies[16]; - decl String:humans[16]; + decl String:title[MENU_LINE_TITLE_LENGTH]; + decl String:zombies[MENU_LINE_SMALL_LENGTH]; + decl String:humans[MENU_LINE_SMALL_LENGTH]; // Set translation language. SetGlobalTransTarget(client); @@ -486,16 +498,16 @@ ClassMultiplierSelectMenu(client) new teamid = ClassAdminTeamSelected[client]; new bool:zombiesselected = bool:(teamid == ZR_CLASS_TEAM_ZOMBIES); - decl String:title[64]; - decl String:napalmtime[48]; - decl String:health[48]; - decl String:regeninterval[48]; - decl String:regenamount[48]; - decl String:infectgain[48]; - decl String:speed[48]; - decl String:knockback[48]; - decl String:jumpheight[48]; - decl String:jumpdistance[48]; + decl String:title[MENU_LINE_TITLE_LENGTH]; + decl String:napalmtime[MENU_LINE_REG_LENGTH]; + decl String:health[MENU_LINE_REG_LENGTH]; + decl String:regeninterval[MENU_LINE_REG_LENGTH]; + decl String:regenamount[MENU_LINE_REG_LENGTH]; + decl String:infectgain[MENU_LINE_REG_LENGTH]; + decl String:speed[MENU_LINE_REG_LENGTH]; + decl String:knockback[MENU_LINE_REG_LENGTH]; + decl String:jumpheight[MENU_LINE_REG_LENGTH]; + decl String:jumpdistance[MENU_LINE_REG_LENGTH]; new Float:currentnapalmtime; new Float:currenthealth; @@ -507,9 +519,6 @@ ClassMultiplierSelectMenu(client) new Float:currentjumpheight; new Float:currentjumpdistance; - // Set translation language. - SetGlobalTransTarget(client); - // Get current multipliers. currentnapalmtime = Float:ClassMultiplierCache[teamid][ClassM_NapalmTime]; currenthealth = Float:ClassMultiplierCache[teamid][ClassM_Health]; @@ -521,6 +530,8 @@ ClassMultiplierSelectMenu(client) currentjumpheight = Float:ClassMultiplierCache[teamid][ClassM_JumpHeight]; currentjumpdistance = Float:ClassMultiplierCache[teamid][ClassM_JumpDistance]; + SetGlobalTransTarget(client); + // Translate phrases. Format(title, sizeof(title), "%t\n", "Classes Menu Multiplier Select Title"); Format(health, sizeof(health), "%t\n %.2f", "Classes Attrib Health", currenthealth); @@ -645,19 +656,18 @@ ClassMultiplierMenu(client, ClassMultipliers:attribute) new Handle:menu = CreateMenu(ClassMultiplierHandle); - decl String:title[64]; - decl String:attributename[48]; - decl String:linebuffer[48]; - - // Set translation language. - SetGlobalTransTarget(client); + decl String:title[MENU_LINE_TITLE_LENGTH]; + decl String:attributename[MENU_LINE_REG_LENGTH]; + decl String:linebuffer[MENU_LINE_REG_LENGTH]; // 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]); SetMenuTitle(menu, title); + SetGlobalTransTarget(client); Format(linebuffer, sizeof(linebuffer), "%t", "Increase by", "0.5"); AddMenuItem(menu, "increasehalf", linebuffer); Format(linebuffer, sizeof(linebuffer), "%t", "Increase by", "0.1"); diff --git a/src/zr/playerclasses/playerclasses.inc b/src/zr/playerclasses/playerclasses.inc index aa156e5..0de2ee4 100644 --- a/src/zr/playerclasses/playerclasses.inc +++ b/src/zr/playerclasses/playerclasses.inc @@ -1055,15 +1055,17 @@ ClassDumpData(index, cachetype, String:buffer[], maxlen) /** * Converts a multiplier attribute to a human readable string. * + * @param client The client index to translate correct language. * @param attribute Attribute to convert. * @param buffer Destination string buffer. * @param maxlen Size of buffer. * @return Number of cells written. */ -ClassMultiplierToString(ClassMultipliers:attribute, String:buffer[], maxlen) +ClassMultiplierToString(client, ClassMultipliers:attribute, String:buffer[], maxlen) { decl String:phrase[48]; + SetGlobalTransTarget(client); switch (attribute) { case ClassM_NapalmTime: diff --git a/src/zr/weapons/menu_weapons.inc b/src/zr/weapons/menu_weapons.inc index 24d2d1d..711cfa4 100644 --- a/src/zr/weapons/menu_weapons.inc +++ b/src/zr/weapons/menu_weapons.inc @@ -49,15 +49,16 @@ bool:WeaponsMenuMain(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: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(zmarket, sizeof(zmarket), "%t", "Weapons menu restrict main market"); // 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, "zmarket", zmarket, MenuGetItemDraw(GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET]))); @@ -126,7 +127,9 @@ WeaponsMenuTypes(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]; @@ -144,6 +147,8 @@ WeaponsMenuTypes(client) // If there are no weapons, add an "(Empty)" line. if (size == 0) { + SetGlobalTransTarget(client); + decl String:empty[MENU_LINE_SMALL_LENGTH]; Format(empty, sizeof(empty), "%t", "Menu empty"); @@ -204,15 +209,16 @@ WeaponsMenuTypeWeapons(client) decl String:typename[WEAPONS_MAX_LENGTH]; 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: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(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. + SetMenuTitle(menu_weapons_typeweapons, title); AddMenuItem(menu_weapons_typeweapons, "restrictall", restrictall, MenuGetItemDraw(!RestrictIsTypeUniform(true, g_iWeaponsCurType[client]))); AddMenuItem(menu_weapons_typeweapons, "unrestrictall", unrestrictall, MenuGetItemDraw(!RestrictIsTypeUniform(false, g_iWeaponsCurType[client]))); @@ -352,18 +358,20 @@ WeaponsMenuZMarket(client) // Create menu handle. 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. + decl String:buyzonesetting[8]; 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. + Format(title, sizeof(title), "%t\n ", "Weapons menu restrict zmarket title"); Format(buyzone, sizeof(buyzone), "%t", "Weapons menu restrict zmarket buyzone", buyzonesetting); + + SetMenuTitle(menu_weapons_market, title); AddMenuItem(menu_weapons_market, "buyzone", buyzone); // Create a "Back" button to the weapons main menu. diff --git a/src/zr/weapons/zmarket.inc b/src/zr/weapons/zmarket.inc index 739a271..02082b9 100644 --- a/src/zr/weapons/zmarket.inc +++ b/src/zr/weapons/zmarket.inc @@ -250,14 +250,12 @@ bool:ZMarketMenuMain(client) // Set translation target as 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. new bool:zmarketrebuy = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_REBUY]); new bool:zmarketrebuyauto = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_REBUY_AUTO]); // Add "Get Current Loadout" option. + decl String:title[MENU_LINE_TITLE_LENGTH]; decl String:getloadout[MENU_LINE_REG_LENGTH]; decl String:viewloadout[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)); // 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(viewloadout, sizeof(viewloadout), "%t", "Weapons menu zmarket main view loadout"); 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"); // Add formatted options to menu. + SetMenuTitle(menu_zmarket_main, title); AddMenuItem(menu_zmarket_main, "Get Loadout", getloadout, MenuGetItemDraw(zmarketrebuy || zmarketrebuyauto)); AddMenuItem(menu_zmarket_main, "View Loadout", viewloadout, MenuGetItemDraw(zmarketrebuy || zmarketrebuyauto)); AddMenuItem(menu_zmarket_main, "Rebuy", rebuy, MenuGetItemDraw(zmarketrebuy || zmarketrebuyauto)); @@ -373,12 +373,6 @@ bool:ZMarketMenuLoadout(client) // Create menu handle. 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:secondaryweapon[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_NVGs], sizeof(rebuyweapons[]), nvgsweapon, sizeof(nvgsweapon)); + SetGlobalTransTarget(client); + // Get the empty translation. decl String:empty[MENU_LINE_SMALL_LENGTH]; Format(empty, sizeof(empty), "%t", "Weapons menu zmarket loadout empty"); @@ -428,6 +424,7 @@ bool:ZMarketMenuLoadout(client) decl String:nvgsbool[8]; ConfigBoolToSetting(bool:nvgsweapon[0], nvgsbool, sizeof(nvgsbool)); + decl String:title[MENU_LINE_TITLE_LENGTH]; decl String:primary[MENU_LINE_REG_LENGTH]; decl String:secondary[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]; // 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(secondary, sizeof(secondary), "%t", "Weapons menu zmarket loadout secondary", secondaryweapon); 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); // Add formatted options to menu. + SetMenuTitle(menu_zmarket_loadout, title); AddMenuItem(menu_zmarket_loadout, "0", primary, MenuGetItemDraw(!StrEqual(primaryweapon, empty))); AddMenuItem(menu_zmarket_loadout, "1", secondary, MenuGetItemDraw(!StrEqual(secondaryweapon, empty))); AddMenuItem(menu_zmarket_loadout, "2", melee, MenuGetItemDraw(!StrEqual(meleeweapon, empty))); @@ -504,10 +503,10 @@ ZMarketMenuTypes(client) new Handle:menu_zmarket_types = CreateMenu(ZMarketMenuTypesHandle); // Set translation target as client. - SetGlobalTransTarget(client); - // Set menu title. - SetMenuTitle(menu_zmarket_types, "%t\n ", "Weapons menu zmarket types title"); + decl String:title[MENU_LINE_TITLE_LENGTH]; + Format(title, sizeof(title), "%t\n ", "Weapons menu zmarket types title"); + SetMenuTitle(menu_zmarket_types, title); decl String:typename[WEAPONS_MAX_LENGTH]; @@ -525,6 +524,8 @@ ZMarketMenuTypes(client) // If there are no weapons, add an "(Empty)" line. if (size == 0) { + SetGlobalTransTarget(client); + decl String:empty[MENU_LINE_SMALL_LENGTH]; Format(empty, sizeof(empty), "%t", "Menu empty"); @@ -601,9 +602,7 @@ ZMarketMenuTypeWeapons(client) decl String:typename[WEAPONS_MAX_LENGTH]; RestrictWeaponTypeGetName(g_iZMarketCurType[client], typename, sizeof(typename)); - // Set menu title. - SetMenuTitle(menu_zmarket_typeweapons, "%t\n ", "Weapons menu zmarket types weapon type title", typename); - + decl String:title[MENU_LINE_TITLE_LENGTH]; decl String:typeweapon[WEAPONS_MAX_LENGTH]; decl String:typeweapondisplay[MENU_LINE_REG_LENGTH]; decl String:display[MENU_LINE_BIG_LENGTH]; @@ -612,6 +611,8 @@ ZMarketMenuTypeWeapons(client) new Handle:arrayTypeWeapons; new count = RestrictGetTypeWeapons(g_iZMarketCurType[client], arrayTypeWeapons); + SetGlobalTransTarget(client); + // x = Array index. for (new x = 0; x < count; x++) { @@ -695,6 +696,9 @@ ZMarketMenuTypeWeapons(client) 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. CloseHandle(arrayTypeWeapons); diff --git a/src/zr/zadmin.inc b/src/zr/zadmin.inc index d591475..0ec51a1 100644 --- a/src/zr/zadmin.inc +++ b/src/zr/zadmin.inc @@ -77,8 +77,7 @@ bool:ZAdminMenu(client) // Set translation target as the 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:weapons[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:ztele[MENU_LINE_REG_LENGTH]; + Format(title, sizeof(title), "%t\n ", "ZAdmin main title"); Format(classmultipliers, sizeof(classmultipliers), "%t", "ZAdmin main class multipliers"); Format(weapons, sizeof(weapons), "%t", "ZAdmin main weapons"); Format(hitgroups, sizeof(hitgroups), "%t", "ZAdmin main hitgroups"); @@ -97,6 +97,7 @@ bool:ZAdminMenu(client) new bool:hitgroupsenabled = GetConVarBool(g_hCvarsList[CVAR_HITGROUPS]); // Add items to menu. + SetMenuTitle(menu_zadmin, title); AddMenuItem(menu_zadmin, "classmultipliers", classmultipliers); AddMenuItem(menu_zadmin, "weapons", weapons); AddMenuItem(menu_zadmin, "hitgroups", hitgroups, MenuGetItemDraw(hitgroupsenabled)); diff --git a/src/zr/zcookies.inc b/src/zr/zcookies.inc index e22ccc4..e09bd7a 100644 --- a/src/zr/zcookies.inc +++ b/src/zr/zcookies.inc @@ -47,9 +47,6 @@ ZCookiesMenuMain(client) // Make client global translations target. SetGlobalTransTarget(client); - // Set menu title. - SetMenuTitle(zcookies_menu_main, "%t\n ", "ZCookies Menu main title"); - decl String:autorebuyenabled[4]; decl String:zhpenabled[4]; decl String:overlayenabled[4]; @@ -59,12 +56,14 @@ ZCookiesMenuMain(client) ConfigBoolToSetting(CookiesGetClientCookieBool(client, g_hZHPEnabledCookie), zhpenabled, sizeof(zhpenabled), 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:zhp[MENU_LINE_REG_LENGTH]; decl String:overlay[MENU_LINE_REG_LENGTH]; decl String:zmarket[MENU_LINE_REG_LENGTH]; // 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(zhp, sizeof(zhp), "%t", "ZCookies menu main zhp", zhpenabled); 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. // Add items to menu. + SetMenuTitle(zcookies_menu_main, title); AddMenuItem(zcookies_menu_main, "autorebuy", autorebuy, MenuGetItemDraw(weapons && zmarketrebuyauto)); AddMenuItem(zcookies_menu_main, "zhp", zhp, MenuGetItemDraw(zhpcvar)); AddMenuItem(zcookies_menu_main, "overlay", overlay, MenuGetItemDraw(overlaytoggle));