From 3720810b61efe2caaa2bb9e8bd38984fd0f3b3d8 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 21 Sep 2006 23:33:05 +0000 Subject: [PATCH] fixed bug am44694 (is_user_alive() on TFC connect failing) --- amxmodx/amxmodx.cpp | 13 +++++++++++++ amxmodx/meta_api.cpp | 2 ++ 2 files changed, 15 insertions(+) diff --git a/amxmodx/amxmodx.cpp b/amxmodx/amxmodx.cpp index 567dc5e1..fed3fbe9 100755 --- a/amxmodx/amxmodx.cpp +++ b/amxmodx/amxmodx.cpp @@ -542,14 +542,27 @@ static cell AMX_NATIVE_CALL is_user_hltv(AMX *amx, cell *params) /* 1 param */ return 0; } +extern bool g_bmod_tfc; static cell AMX_NATIVE_CALL is_user_alive(AMX *amx, cell *params) /* 1 param */ { int index = params[1]; if (index < 1 || index > gpGlobals->maxClients) + { return 0; + } CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); + + if (g_bmod_tfc) + { + edict_t *e = pPlayer->pEdict; + if (e->v.flags & FL_SPECTATOR || + (!e->v.team || !e->v.playerclass)) + { + return 0; + } + } return ((pPlayer->ingame && pPlayer->IsAlive()) ? 1 : 0); } diff --git a/amxmodx/meta_api.cpp b/amxmodx/meta_api.cpp index f7b7d31c..55232ed3 100755 --- a/amxmodx/meta_api.cpp +++ b/amxmodx/meta_api.cpp @@ -96,6 +96,7 @@ String g_log_dir; String g_mod_name; XVars g_xvars; +bool g_bmod_tfc; bool g_bmod_cstrike; bool g_bmod_dod; bool g_dontprecache; @@ -1588,6 +1589,7 @@ C_DLLEXPORT int GetEngineFunctions(enginefuncs_t *pengfuncsFromEngine, int *inte } else { g_bmod_cstrike = false; g_bmod_dod = !stricmp(g_mod_name.c_str(), "dod"); + g_bmod_tfc = !stricmp(g_mod_name.c_str(), "tfc"); } meta_engfuncs.pfnCmd_Argc = C_Cmd_Argc;