Fixed setting players online once again

This commit is contained in:
Johnny Bergström 2004-03-31 06:15:27 +00:00
parent 52722d7ebf
commit 773e358596
2 changed files with 19 additions and 21 deletions

View File

@ -1359,12 +1359,27 @@ C_DLLEXPORT int GetEntityAPI2(DLL_FUNCTIONS *pFunctionTable, int *interfaceVersi
return(TRUE);
}
/****GetEntityAPI2_Post**********************************************************/
void ClientUserInfoChanged_Post( edict_t *pEntity, char *infobuffer ) {
int index = ENTINDEX(pEntity);
if (!g_players[index].GetOnline())
// Only BOTs are set online here! Players must not, because then cs_user_* natives will crash in client_connect, possibly also other early forwards.
if (!g_players[index].GetOnline() && strcmp(GETPLAYERAUTHID(pEntity), "BOT") == 0) {
g_players[index].SetOnline(true);
//LOG_CONSOLE(PLID, "CSTRIKE MODULE: ClientUserInfoChanged_Post: %d was set to be online! (Auth: %s)", index, GETPLAYERAUTHID(pEntity));
}
RETURN_META(MRES_IGNORED);
}
void ClientPutInServer_Post( edict_t *pEntity ) {
int index = ENTINDEX(pEntity);
// At this place normal players will be set online. Bots (at least MM bots) don't normally ever get caught here so they can't be set online here.
// There might be other implementations of bots though that are caught by MM, so they will be set online here if they didn't already
// in ClientUserInfoChanged_Post above...
if (!g_players[index].GetOnline()) {
g_players[index].SetOnline(true);
//LOG_CONSOLE(PLID, "CSTRIKE MODULE: ClientPutInServer_Post: %d was set to be online! (Auth: %s)", index, GETPLAYERAUTHID(pEntity));
}
RETURN_META(MRES_IGNORED);
}
@ -1372,6 +1387,7 @@ void ClientUserInfoChanged_Post( edict_t *pEntity, char *infobuffer ) {
DLL_FUNCTIONS gFunctionTable_Post;
C_DLLEXPORT int GetEntityAPI2_Post( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion ) {
gFunctionTable_Post.pfnClientUserInfoChanged = ClientUserInfoChanged_Post;
gFunctionTable_Post.pfnClientPutInServer = ClientPutInServer_Post;
if(*interfaceVersion!=INTERFACE_VERSION) {
LOG_ERROR(PLID, "GetEntityAPI2_Post version mismatch; requested=%d ours=%d", *interfaceVersion, INTERFACE_VERSION);

View File

@ -1,4 +1,4 @@
#define __cswonbuild__ // comment when compiling for STEAM
//#define __cswonbuild__ // comment when compiling for STEAM
/* AMX Mod X
* Counter-Strike Module
@ -151,24 +151,6 @@ pfnmodule_engine_g* g_engModuleFunc;
#define OFFSET_HOSTAGEID 487 + EXTRAOFFSET
#endif // defined __cswonbuild__
// Offsets of ammo amount in player entities
/*
382 int awm
383 int scout, ak, g3
384 int para
385 int famas, m4a1, aug, sg550, galil, sg552
386 int m3, xm
387 int usp, ump, mac
388 int fiveseven, p90
389 int deagle
390 int p228
391 int glock, mp5, tmp, elites
392 int flash
393 int he
394 int smoke
395 int c4
*/
// Ids of weapons in CS
#define CSW_P228 1
//#define CSW_SHIELD 2