mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-26 06:45:37 +03:00
Update core to use amx_language cvar instead of vault
This commit is contained in:
parent
1d17835e9a
commit
b4d006438c
@ -52,18 +52,18 @@ const char *translate(AMX *amx, cell amxaddr, const char *key)
|
|||||||
amx_cl_langs = CVAR_GET_POINTER("amx_client_languages");
|
amx_cl_langs = CVAR_GET_POINTER("amx_client_languages");
|
||||||
if ( (int)amx_cl_langs->value == 0 )
|
if ( (int)amx_cl_langs->value == 0 )
|
||||||
{
|
{
|
||||||
pLangName = g_vault.get("server_language");
|
pLangName = amxmodx_language->string;
|
||||||
} else {
|
} else {
|
||||||
pLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I(g_langMngr.GetDefLang())->pEdict, "lang");
|
pLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I(g_langMngr.GetDefLang())->pEdict, "lang");
|
||||||
}
|
}
|
||||||
} else if (addr[0] == LANG_SERVER) {
|
} else if (addr[0] == LANG_SERVER) {
|
||||||
pLangName = g_vault.get("server_language");
|
pLangName = amxmodx_language->string;
|
||||||
} else if (addr[0] >= 1 && addr[0] <= gpGlobals->maxClients) {
|
} else if (addr[0] >= 1 && addr[0] <= gpGlobals->maxClients) {
|
||||||
if (!amx_cl_langs)
|
if (!amx_cl_langs)
|
||||||
amx_cl_langs = CVAR_GET_POINTER("amx_client_languages");
|
amx_cl_langs = CVAR_GET_POINTER("amx_client_languages");
|
||||||
if ( (int)amx_cl_langs->value == 0 )
|
if ( (int)amx_cl_langs->value == 0 )
|
||||||
{
|
{
|
||||||
pLangName = g_vault.get("server_language");
|
pLangName = amxmodx_language->string;
|
||||||
} else {
|
} else {
|
||||||
pLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I(addr[0])->pEdict, "lang");
|
pLangName = ENTITY_KEYVALUE(GET_PLAYER_POINTER_I(addr[0])->pEdict, "lang");
|
||||||
}
|
}
|
||||||
@ -110,9 +110,9 @@ const char *translate(AMX *amx, cell amxaddr, const char *key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (addr[0] != LANG_SERVER)
|
if (addr[0] != LANG_SERVER)
|
||||||
def = g_langMngr.GetDef(g_vault.get("server_language"), key, status);
|
def = g_langMngr.GetDef(amxmodx_language->string, key, status);
|
||||||
|
|
||||||
if (!def && (strcmp(pLangName, "en") != 0 && strcmp(g_vault.get("server_language"), "en") != 0))
|
if (!def && (strcmp(pLangName, "en") != 0 && strcmp(amxmodx_language->string, "en") != 0))
|
||||||
def = g_langMngr.GetDef("en", key, status);
|
def = g_langMngr.GetDef("en", key, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,9 +142,11 @@ cvar_t init_amxmodx_version = {"amxmodx_version", "", FCVAR_SERVER | FCVAR_SPONL
|
|||||||
cvar_t init_amxmodx_modules = {"amxmodx_modules", "", FCVAR_SPONLY};
|
cvar_t init_amxmodx_modules = {"amxmodx_modules", "", FCVAR_SPONLY};
|
||||||
cvar_t init_amxmodx_debug = {"amx_debug", "1", FCVAR_SPONLY};
|
cvar_t init_amxmodx_debug = {"amx_debug", "1", FCVAR_SPONLY};
|
||||||
cvar_t init_amxmodx_mldebug = {"amx_mldebug", "", FCVAR_SPONLY};
|
cvar_t init_amxmodx_mldebug = {"amx_mldebug", "", FCVAR_SPONLY};
|
||||||
|
cvar_t init_amxmodx_language = {"amx_language", "en", FCVAR_SERVER};
|
||||||
cvar_t init_amxmodx_cl_langs = {"amx_client_languages", "", FCVAR_SERVER};
|
cvar_t init_amxmodx_cl_langs = {"amx_client_languages", "", FCVAR_SERVER};
|
||||||
cvar_t* amxmodx_version = NULL;
|
cvar_t* amxmodx_version = NULL;
|
||||||
cvar_t* amxmodx_modules = NULL;
|
cvar_t* amxmodx_modules = NULL;
|
||||||
|
cvar_t* amxmodx_language = NULL;
|
||||||
cvar_t* hostname = NULL;
|
cvar_t* hostname = NULL;
|
||||||
cvar_t* mp_timelimit = NULL;
|
cvar_t* mp_timelimit = NULL;
|
||||||
|
|
||||||
@ -465,12 +467,6 @@ int C_Spawn(edict_t *pent)
|
|||||||
g_vault.setSource(build_pathname_r(file, sizeof(file) - 1, "%s", get_localinfo("amxx_vault", "addons/amxmodx/configs/vault.ini")));
|
g_vault.setSource(build_pathname_r(file, sizeof(file) - 1, "%s", get_localinfo("amxx_vault", "addons/amxmodx/configs/vault.ini")));
|
||||||
g_vault.loadVault();
|
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
|
// ###### Init time and freeze tasks
|
||||||
g_game_timeleft = g_bmod_dod ? 1.0f : 0.0f;
|
g_game_timeleft = g_bmod_dod ? 1.0f : 0.0f;
|
||||||
g_task_time = gpGlobals->time + 99999.0f;
|
g_task_time = gpGlobals->time + 99999.0f;
|
||||||
@ -1446,9 +1442,11 @@ C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, m
|
|||||||
CVAR_REGISTER(&init_amxmodx_modules);
|
CVAR_REGISTER(&init_amxmodx_modules);
|
||||||
CVAR_REGISTER(&init_amxmodx_debug);
|
CVAR_REGISTER(&init_amxmodx_debug);
|
||||||
CVAR_REGISTER(&init_amxmodx_mldebug);
|
CVAR_REGISTER(&init_amxmodx_mldebug);
|
||||||
|
CVAR_REGISTER(&init_amxmodx_language);
|
||||||
CVAR_REGISTER(&init_amxmodx_cl_langs);
|
CVAR_REGISTER(&init_amxmodx_cl_langs);
|
||||||
|
|
||||||
amxmodx_version = CVAR_GET_POINTER(init_amxmodx_version.name);
|
amxmodx_version = CVAR_GET_POINTER(init_amxmodx_version.name);
|
||||||
|
amxmodx_language = CVAR_GET_POINTER(init_amxmodx_language.name);
|
||||||
|
|
||||||
REG_SVR_COMMAND("amxx", amx_command);
|
REG_SVR_COMMAND("amxx", amx_command);
|
||||||
|
|
||||||
|
@ -134,12 +134,23 @@ amx_extendmap_max 90
|
|||||||
// Default value: 15
|
// Default value: 15
|
||||||
amx_extendmap_step 15
|
amx_extendmap_step 15
|
||||||
|
|
||||||
|
// Server language in ISO 639-1 format
|
||||||
|
// Please see data/lang/languages.txt file for a list of supported languages
|
||||||
|
//
|
||||||
|
// Default value: en
|
||||||
|
amx_language "en"
|
||||||
|
|
||||||
// If you set this to 0, clients cannot chose their language, instead they use
|
// If you set this to 0, clients cannot chose their language, instead they use
|
||||||
// whatever language the server is configured to use.
|
// whatever language the server is configured to use.
|
||||||
//
|
//
|
||||||
// Default value: 1
|
// Default value: 1
|
||||||
amx_client_languages 1
|
amx_client_languages 1
|
||||||
|
|
||||||
|
// If you set this to 0, clients will not see a message about amx_langmenu when they join the server
|
||||||
|
//
|
||||||
|
// Default value: 1
|
||||||
|
amx_language_display_msg 1
|
||||||
|
|
||||||
// Plugin Debug mode
|
// Plugin Debug mode
|
||||||
// 0 - No debugging (garbage line numbers)
|
// 0 - No debugging (garbage line numbers)
|
||||||
// 1 - Plugins with "debug" option in plugins.ini are put into debug mode
|
// 1 - Plugins with "debug" option in plugins.ini are put into debug mode
|
||||||
|
Loading…
Reference in New Issue
Block a user