Actually, LANG_PLAYER will work too. To explain more :
AMXX does that basically to get a language :
- Checking amx_client_languages first and if set to 0, language will be from server_language cvar.
- Otherwise getting the value from the client's cvar lang.
Here the code of client_print :
PHP Code:
static cell AMX_NATIVE_CALL client_print(AMX *amx, cell *params) /* 3 param */
{
int len = 0;
char *msg;
if (params[1] == 0)
{
for (int i = 1; i <= gpGlobals->maxClients; ++i)
{
CPlayer *pPlayer = GET_PLAYER_POINTER_I(i);
if (pPlayer->ingame)
{
g_langMngr.SetDefLang(i);
msg = format_amxstring(amx, params, 3, len);
msg[len++] = '\n';
msg[len] = 0;
UTIL_ClientPrint(pPlayer->pEdict, params[2], msg);
}
}
} else {
int index = params[1];
if (index < 1 || index > gpGlobals->maxClients)
{
LogError(amx, AMX_ERR_NATIVE, "Invalid player id %d", index);
return 0;
}
CPlayer* pPlayer = GET_PLAYER_POINTER_I(index);
g_langMngr.SetDefLang(index);
msg = format_amxstring(amx, params, 3, len);
msg[len++] = '\n';
msg[len] = 0;
if (pPlayer->ingame)
UTIL_ClientPrint(pPlayer->pEdict, params[2], msg); //format_amxstring(amx, params, 3, len));
}
return len;
}
Each time, before formatting the string, the current player's id, whatever from the first param or the loop, is saved in a global var. (SetDefLang)
We assume
amx_client_languages is set on 1 :
- When you pass LANG_SERVER, language is retrieved from server_language cvar.
- When you pass LANG_PLAYER, language is retrieved from lang client's cvar using the player's index saved in the global var.
- When you pass the player's index, language is retrieved from lang client's cvar using this index.
LANG_PLAYER is meant to be used when you can't pass a player's index. But since the current player's index is always saved before formatting the string, LANG_PLAYER will work even if you send client_print to a specific player, but that's not appropriate to do that.
Hope you understand better.
-------
About your plugin, I don't have much reviewed, but If there is known bug, I would prefer you fix it first. But for sure such plugin is meant to be approved later.
__________________