Your code is not correct.
Code:
public lang(id) {
new szCurLang[ LANG_SIZE ];
get_user_info( id, "lang", szCurLang, charsmax( szCurLang ) );
if((lang(id)=="en"))
{
client_print_color( id, print_team_red, "^4Lang en");
} else {
client_print_color( id, print_team_red, "^3Lang other");
}
}
This part of the code would cause a infinity loop, so:
Code:
public lang(id) {
new szCurLang[ LANG_SIZE ];
get_user_info( id, "lang", szCurLang, charsmax( szCurLang ) );
if(equali(szCurLang, "en"))
{
client_print_color( id, print_team_red, "^4Lang en");
} else {
client_print_color( id, print_team_red, "^3Lang other");
}
}
Besides, why do you just not use the dictionary functionality of the amxmodx? Something like this:
Code:
#include <amxmodx>
#define PLUGIN "Plugin"
#define VERSION "Version"
#define AUTHOR "Author"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
// Language file, ${amxx_datadir}/lang
register_dictionary("filename.txt");
/* filename.txt:
[en]
TRANSLATION_KEY = Whatever English
[ru]
TRANSLATION_KEY = Whatever Russian
*/
register_clcmd("say whatever", "whatever")
}
public whatever(id) {
ChatColor(id, "%L", id, "TRANSLATION_KEY");
}
stock ChatColor(const id, const szMessage[], any:...)
{
static szMsg[190], IdMsg;
vformat(szMsg, charsmax(szMsg), szMessage, 3);
if(!IdMsg) IdMsg = get_user_msgid("SayText");
message_begin(MSG_ONE, IdMsg, .player = id);
write_byte(id);
write_string(szMsg);
message_end();
}
__________________