Thread: [Solved] Translation and string bugs
View Single Post
Author Message
MAGNAT2645
Senior Member
Join Date: Nov 2015
Location: AlliedMods.net
Old 04-20-2018 , 14:00   Translation and string bugs
Reply With Quote #1

I'm using SmartMenu (methodmap from Menu) that have AddItemFormat method (very useful) and SmartPanel (methodmap from Panel).
My problem is that menu/panel can't translate phrase via client index (just throw error like "Translation failed: invalid client index 1431192909").

This problem seems to appear only on SmartMenu and SmartPanel methods that use VFormat.
Example:
Code:
public Action CMD_Test(int client, int args) {
	SmartPanel hPanel = new SmartPanel();
	hPanel.SetTitleFormat(_, "%T", "CMD_TEST_MENU_TITLE", client);
	hPanel.DrawItemFormat(_, "%T", "One", client);
	hPanel.DrawItemFormat(_, "%T", "Two", client);
	hPanel.SendToClient(client, PanelHandler_Test, 20);
	delete hPanel;
	return Plugin_Handled;
}
Log:
Code:
L 04/20/2018 - 22:32:58: [SM] Exception reported: Translation failed: invalid client index 1162756432
L 04/20/2018 - 22:32:58: [SM] Blaming: pls.smx
L 04/20/2018 - 22:32:58: [SM] Call stack trace:
L 04/20/2018 - 22:32:58: [SM]   [0] VFormat
L 04/20/2018 - 22:32:58: [SM]   [1] Line 21, C:\Games\tf2server\tf\addons\sourcemod\scripting\include\pls/menus.inc::SmartPanel.SetTitleFormat
L 04/20/2018 - 22:32:58: [SM]   [2] Line 891, C:\Games\tf2server\tf\addons\sourcemod\scripting\pls.sp::CMD_Test
SetTitleFormat method source:
Code:
public void SetTitleFormat(bool onlyIfEmpty = false, const char[] text, any ...) {
	char sTitle[MAX_MENU_TITLE_LENGTH];
	VFormat(sTitle, MAX_MENU_TITLE_LENGTH, text, 3);
	this.SetTitle(sTitle, onlyIfEmpty);
}
Also i have problem with some HEX strings (colors). For example i have KeyValues config:
Code:
"Senior Member"
{
	"color" "006400"
	"kills" "6500"
}
I have tried to debug and then console said "sName: Senior Member | HEX: 6400 | Kills: 6500".
Why 6400 instead of 006400?

This also appears on 9400D3 (output: 9400000) and 4D7455 (output: 1.#INF0)
__________________

Last edited by MAGNAT2645; 04-22-2018 at 03:19. Reason: Solved
MAGNAT2645 is offline