From 2c4e5660983f1db6c924a3f53a700a2edbc43d9f Mon Sep 17 00:00:00 2001 From: Pavol Marko Date: Tue, 3 Feb 2004 15:26:57 +0000 Subject: [PATCH] amxmodx_version cvar support --- amxmodx/amxmod.cpp | 4 ++-- amxmodx/meta_api.cpp | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/amxmodx/amxmod.cpp b/amxmodx/amxmod.cpp index 679df8ab..4e789ea5 100755 --- a/amxmodx/amxmod.cpp +++ b/amxmodx/amxmod.cpp @@ -1898,7 +1898,7 @@ static cell AMX_NATIVE_CALL remove_cvar_flags(AMX *amx, cell *params) { int ilen; char* sCvar = get_amxstring(amx,params[1],0,ilen); - if ( !strcmp(sCvar,"amx_version") || + if ( !strcmp(sCvar,"amx_version") || !strcmp(sCvar,"amxmodx_version") || !strcmp(sCvar,"fun_version") || !strcmp(sCvar,"sv_cheats") ) return 0; cvar_t* pCvar = CVAR_GET_POINTER(sCvar); @@ -1921,7 +1921,7 @@ static cell AMX_NATIVE_CALL set_cvar_flags(AMX *amx, cell *params) { int ilen; char* sCvar = get_amxstring(amx,params[1],0,ilen); - if ( !strcmp(sCvar,"amx_version") || + if ( !strcmp(sCvar,"amx_version") || !strcmp(sCvar,"amxmodx_version") || !strcmp(sCvar,"fun_version") || !strcmp(sCvar,"sv_cheats") ) return 0; cvar_t* pCvar = CVAR_GET_POINTER(sCvar); diff --git a/amxmodx/meta_api.cpp b/amxmodx/meta_api.cpp index 561e0557..7c891739 100755 --- a/amxmodx/meta_api.cpp +++ b/amxmodx/meta_api.cpp @@ -93,7 +93,9 @@ int mState; int g_srvindex; cvar_t init_amx_version={"amx_version","", FCVAR_SERVER | FCVAR_SPONLY}; +cvar_t init_amxmodx_version={"amxmodx_version","", FCVAR_SERVER | FCVAR_SPONLY}; cvar_t* amx_version = NULL; +cvar_t* amxmodx_version = NULL; cvar_t* hostname = NULL; cvar_t* mp_timelimit = NULL; @@ -246,8 +248,12 @@ int Spawn( edict_t *pent ) { sprintf( buffer,"%s (%d module%s)", AMX_VERSION, loaded , (loaded == 1) ? "" : "s" ); CVAR_SET_STRING( "amx_version" , buffer ); + CVAR_SET_STRING( "amxmodx_version", buffer); + } + else { + CVAR_SET_STRING( "amx_version", AMX_VERSION ); + CVAR_SET_STRING( "amxmodx_version", AMX_VERSION ); } - else CVAR_SET_STRING( "amx_version" , AMX_VERSION ); // ###### Save log dir g_log_dir.set( get_localinfo("amx_logdir" , "addons/amx/logs" ) ); @@ -950,7 +956,9 @@ C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, m memcpy(pFunctionTable, &gMetaFunctionTable, sizeof(META_FUNCTIONS)); gpGamedllFuncs=pGamedllFuncs; CVAR_REGISTER (&init_amx_version); + CVAR_REGISTER (&init_amxmodx_version); amx_version = CVAR_GET_POINTER(init_amx_version.name ); + amxmodx_version = CVAR_GET_POINTER(init_amxmodx_version.name); REG_SVR_COMMAND("amx",amx_command); char gameDir[512];