Fix some natives relying on a known engine bug related to last player's edict being invalid
This commit is contained in:
@ -83,7 +83,7 @@ static cell AMX_NATIVE_CALL emit_sound(AMX *amx, cell *params) /* 7 param */
|
||||
EMIT_SOUND_DYN2(pPlayer->pEdict, channel, szSample, vol, att, flags, pitch);
|
||||
}
|
||||
} else {
|
||||
edict_t* pEdict = INDEXENT(params[1]);
|
||||
edict_t* pEdict = GETEDICT(params[1]);
|
||||
|
||||
if (!FNullEnt(pEdict))
|
||||
EMIT_SOUND_DYN2(pEdict, channel, szSample, vol, att, flags, pitch);
|
||||
|
@ -145,6 +145,7 @@ void UTIL_TrimRight(char *buffer);
|
||||
#define GET_PLAYER_POINTER(e) (&g_players[ENTINDEX(e)])
|
||||
//#define GET_PLAYER_POINTER(e) (&g_players[(((int)e-g_edict_point)/sizeof(edict_t))])
|
||||
#define GET_PLAYER_POINTER_I(i) (&g_players[i])
|
||||
#define GETEDICT(n) ((n >= 1 && n <= gpGlobals->maxClients) ? GET_PLAYER_POINTER_I(n)->pEdict : INDEXENT(n))
|
||||
|
||||
struct WeaponsVault
|
||||
{
|
||||
|
@ -423,7 +423,7 @@ static cell _message_begin(AMX *amx, cell *params, bool useFloat) /* 4 param */
|
||||
return 0;
|
||||
}
|
||||
|
||||
MESSAGE_BEGIN(params[1], params[2], NULL, INDEXENT(params[4]));
|
||||
MESSAGE_BEGIN(params[1], params[2], NULL, GETEDICT(params[4]));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -771,7 +771,7 @@ static cell _emessage_begin(AMX *amx, cell *params, bool useFloat)
|
||||
return 0;
|
||||
}
|
||||
|
||||
g_pEngTable->pfnMessageBegin(params[1], params[2], NULL, INDEXENT(params[4]));
|
||||
g_pEngTable->pfnMessageBegin(params[1], params[2], NULL, GETEDICT(params[4]));
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user