Fixed default language errors

This commit is contained in:
David Anderson 2004-08-13 10:01:41 +00:00
parent 5469f70dba
commit 060a0a565c
2 changed files with 11 additions and 4 deletions

View File

@ -528,11 +528,13 @@ const char *CLangMngr::Format(const char *src, ...)
if ((int)langName == -1)
cpLangName = g_vault.get("server_language");
else if ((int)langName >= 1 && (int)langName <= 32)
cpLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I((int)langName)->pEdict, "_language");
cpLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I((int)langName)->pEdict, "lang");
else
{
cpLangName = langName;
}
if (!cpLangName || strlen(cpLangName) < 1)
cpLangName = "en";
char *key = va_arg(argptr, char*);
const char *def = GetDef(cpLangName, key);
while (*def)
@ -558,7 +560,6 @@ const char *CLangMngr::Format(const char *src, ...)
sprintf(outptr, "%f", tmpArg);
outptr += strlen(outptr);
break;
break;
}
case INSERT_NEWLINE:
*outptr++ = '\n';
@ -648,12 +649,14 @@ char * CLangMngr::FormatAmxString(AMX *amx, cell *params, int parm, int &len)
if (*pLangName == -1)
cpLangName = g_vault.get("server_language");
else if (*pLangName >= 1 && *pLangName <= 32)
cpLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I(*pLangName)->pEdict, "_language");
cpLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I(*pLangName)->pEdict, "lang");
else
{
int len = 0;
cpLangName = get_amxstring(amx, langName, 2, len);
}
if (!cpLangName || strlen(cpLangName) < 1)
cpLangName = "en";
int len;
char *key = get_amxstring(amx, params[parm++], 1, len);
const char *def = GetDef(cpLangName, key);

View File

@ -252,7 +252,11 @@ int C_Spawn( edict_t *pent ) {
// ###### Load Vault
g_vault.setSource( build_pathname("%s", get_localinfo("amxx_vault", "addons/amxx/configs/vault.ini")) );
g_vault.loadVault( );
if (strlen(g_vault.get("server_language")) < 1)
{
g_vault.put("server_language", "en");
g_vault.saveVault();
}
// ###### Init time and freeze tasks
g_game_timeleft = g_bmod_dod ? 1 : 0;