You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The %l format parameter relies on persistence of the language target set by SetGlobalTransTarget(). However, when this was implemented, it reused an existing global variable. This global variable gets set by several other functions that use it only for temporary purposes (e.g. server_print()). Because of this, it seems that the %l format deserves its own global variable so that client-related print functions can properly use this persisted language target.
Can be reproduced with the following plugin based on the thread linked above:
#include <amxmodx>
public plugin_init()
{
register_dictionary("common.txt")
register_concmd("testlang", "cmdTest")
}
public cmdTest(id)
{
SetGlobalTransTarget(id)
custom_print(id, "%l", "CL_NOT_FOUND");
log_amx("this is gonna force language change to default");
custom_print(id, "%l", "CL_NOT_FOUND");
return PLUGIN_HANDLED
}
custom_print(id, msg[], any:...)
{
new formattedMsg[MAX_FMT_LENGTH];
vformat(formattedMsg, charsmax(formattedMsg), msg, 3);
console_print(id, "%s ^3%s", "[prefix]", formattedMsg);
}
Join the server and set your personal language to a language that does not match the server default language (e.g. if your server default is "en" then run setinfo lang fr). Run testlang in console.
The text was updated successfully, but these errors were encountered:
fysiks1
added a commit
to fysiks1/amxmodx
that referenced
this issue
Jan 21, 2025
The
%l
format parameter relies on persistence of the language target set bySetGlobalTransTarget()
. However, when this was implemented, it reused an existing global variable. This global variable gets set by several other functions that use it only for temporary purposes (e.g.server_print()
). Because of this, it seems that the%l
format deserves its own global variable so that client-related print functions can properly use this persisted language target.Previous discussion in the forums here.
Can be reproduced with the following plugin based on the thread linked above:
Join the server and set your personal language to a language that does not match the server default language (e.g. if your server default is "en" then run
setinfo lang fr
). Runtestlang
in console.The text was updated successfully, but these errors were encountered: