From b4ad89e6ef0cc5fadf05192cc0f959dc148d7cc0 Mon Sep 17 00:00:00 2001 From: Pavol Marko Date: Wed, 22 Dec 2004 18:19:51 +0000 Subject: [PATCH] Reverted last changes --- amxmodx/CMisc.cpp | 3 +++ amxmodx/CMisc.h | 1 + amxmodx/amxmodx.cpp | 12 ++++++------ amxmodx/meta_api.cpp | 10 ++-------- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/amxmodx/CMisc.cpp b/amxmodx/CMisc.cpp index f47e5575..fbe977fc 100755 --- a/amxmodx/CMisc.cpp +++ b/amxmodx/CMisc.cpp @@ -39,6 +39,7 @@ void CPlayer::Init( edict_t* e , int i ) pEdict = e; initialized = false; ingame = false; + bot = false; authorized = false; current = 0; @@ -58,6 +59,7 @@ void CPlayer::Disconnect() { ingame = false; initialized = false; authorized = false; + bot = 0; } void CPlayer::PutInServer() { @@ -68,6 +70,7 @@ bool CPlayer::Connect(const char* connectname,const char* ipaddress) { name.assign(connectname); ip.assign(ipaddress); time = gpGlobals->time; + bot = IsBot(); death_killer = 0; memset(flags,0,sizeof(flags)); memset(weapons,0,sizeof(weapons)); diff --git a/amxmodx/CMisc.h b/amxmodx/CMisc.h index 3184b178..45e88b4d 100755 --- a/amxmodx/CMisc.h +++ b/amxmodx/CMisc.h @@ -74,6 +74,7 @@ public: bool initialized; bool ingame; + bool bot; bool authorized; float time; diff --git a/amxmodx/amxmodx.cpp b/amxmodx/amxmodx.cpp index bbc73b7f..a35aab73 100755 --- a/amxmodx/amxmodx.cpp +++ b/amxmodx/amxmodx.cpp @@ -158,7 +158,7 @@ static cell AMX_NATIVE_CALL console_cmd(AMX *amx, cell *params) /* 2 param */ } else{ CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); - if ( !pPlayer->IsBot() && pPlayer->initialized ) CLIENT_COMMAND(pPlayer->pEdict, cmd ); + if ( !pPlayer->bot && pPlayer->initialized ) CLIENT_COMMAND(pPlayer->pEdict, cmd ); } return len; @@ -399,7 +399,7 @@ static cell AMX_NATIVE_CALL is_user_bot(AMX *amx, cell *params) /* 1 param */ int index = params[1]; if (index<1||index>gpGlobals->maxClients) return 0; - return (GET_PLAYER_POINTER_I(index)->IsBot() ? 1 : 0); + return (GET_PLAYER_POINTER_I(index)->bot ? 1 : 0); } @@ -1140,7 +1140,7 @@ static cell AMX_NATIVE_CALL client_cmd(AMX *amx, cell *params) /* 2 param */ if (params[1] == 0) { for(int i = 1; i <= gpGlobals->maxClients; ++i){ CPlayer* pPlayer = GET_PLAYER_POINTER_I(i); - if (!pPlayer->IsBot() && pPlayer->initialized /*&& pPlayer->ingame*/ ) + if (!pPlayer->bot && pPlayer->initialized /*&& pPlayer->ingame*/ ) CLIENT_COMMAND(pPlayer->pEdict, cmd ); } } @@ -1151,7 +1151,7 @@ static cell AMX_NATIVE_CALL client_cmd(AMX *amx, cell *params) /* 2 param */ return 0; } CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); - if ( !pPlayer->IsBot() && pPlayer->initialized /*&& pPlayer->ingame*/ ) + if ( !pPlayer->bot && pPlayer->initialized /*&& pPlayer->ingame*/ ) CLIENT_COMMAND(pPlayer->pEdict, cmd ); } return len; @@ -1503,7 +1503,7 @@ static cell AMX_NATIVE_CALL get_players(AMX *amx, cell *params) /* 4 param */ if (pPlayer->ingame){ if (pPlayer->IsAlive() ? (flags & 2) : (flags & 1)) continue; - if (pPlayer->IsBot() ? (flags & 4) : (flags & 8)) + if (pPlayer->bot ? (flags & 4) : (flags & 8)) continue; if ((flags & 16) && (pPlayer->teamId != team) ) continue; @@ -1547,7 +1547,7 @@ static cell AMX_NATIVE_CALL find_player(AMX *amx, cell *params) /* 1 param */ if (pPlayer->ingame){ if (pPlayer->IsAlive()?(flags&64):(flags&32)) continue; - if (pPlayer->IsBot()?(flags&128):(flags&256)) + if (pPlayer->bot?(flags&128):(flags&256)) continue; if (flags&1){ if (flags&2048) { diff --git a/amxmodx/meta_api.cpp b/amxmodx/meta_api.cpp index 5b045bdb..12853679 100755 --- a/amxmodx/meta_api.cpp +++ b/amxmodx/meta_api.cpp @@ -524,7 +524,7 @@ void C_ServerDeactivate_Post() { BOOL C_ClientConnect_Post( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] ){ CPlayer* pPlayer = GET_PLAYER_POINTER(pEntity); - if (!pPlayer->IsBot()) { + if (!pPlayer->bot) { bool a = pPlayer->Connect(pszName,pszAddress); @@ -554,14 +554,9 @@ void C_ClientDisconnect( edict_t *pEntity ) { RETURN_META(MRES_IGNORED); } -void C_ClientDisconnect_Post(edict_t *pEntity) -{ - pEntity->v.flags &= ~FL_FAKECLIENT; -} - void C_ClientPutInServer_Post( edict_t *pEntity ) { CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity); - if (!pPlayer->IsBot()) { + if (!pPlayer->bot) { pPlayer->PutInServer(); ++g_players_num; @@ -1235,7 +1230,6 @@ C_DLLEXPORT int GetEntityAPI2_Post( DLL_FUNCTIONS *pFunctionTable, int *interfac gFunctionTable_Post.pfnClientUserInfoChanged = C_ClientUserInfoChanged_Post; gFunctionTable_Post.pfnServerActivate = C_ServerActivate_Post; gFunctionTable_Post.pfnClientConnect = C_ClientConnect_Post; - gFunctionTable_Post.pfnClientDisconnect = C_ClientDisconnect_Post; gFunctionTable_Post.pfnStartFrame = C_StartFrame_Post; gFunctionTable_Post.pfnServerDeactivate = C_ServerDeactivate_Post;