Touch it and die, bail.

This commit is contained in:
Steve Dudenhoeffer 2004-10-20 14:24:54 +00:00
parent f14808e009
commit 89eda75b1f
2 changed files with 6 additions and 0 deletions

View File

@ -19,6 +19,7 @@ inline edict_t* INDEXENT2( int iEdictNum )
else else
return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum); return (*g_engfuncs.pfnPEntityOfEntIndex)(iEdictNum);
} }
#ifdef DONT_TOUCH_THIS_AGAIN_BAIL
#define CHECK_ENTITY(x) \ #define CHECK_ENTITY(x) \
if (x < 0 || x > gpGlobals->maxEntities) { \ if (x < 0 || x > gpGlobals->maxEntities) { \
MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \ MF_LogError(amx, AMX_ERR_NATIVE, "Entity out of range (%d)", x); \
@ -36,7 +37,9 @@ inline edict_t* INDEXENT2( int iEdictNum )
} \ } \
} \ } \
} }
#endif
#define CHECK_ENTITY(x) if (x != 0 && (FNullEnt(INDEXENT2(x)) || x < 0 || x > gpGlobals->maxEntities)) { MF_RaiseAmxError(amx,AMX_ERR_NATIVE); return 0; }
extern AMX_NATIVE_INFO engfunc_natives[]; extern AMX_NATIVE_INFO engfunc_natives[];
extern AMX_NATIVE_INFO dllfunc_natives[]; extern AMX_NATIVE_INFO dllfunc_natives[];
extern AMX_NATIVE_INFO pev_natives[]; extern AMX_NATIVE_INFO pev_natives[];

View File

@ -4,6 +4,7 @@
static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params) static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
{ {
int index=params[1]; int index=params[1];
#ifdef DONT_TOUCH_THIS_AGAIN_BAIL
if (index >= 1 && index <= gpGlobals->maxClients) if (index >= 1 && index <= gpGlobals->maxClients)
{ {
if (!MF_IsPlayerIngame(index)) if (!MF_IsPlayerIngame(index))
@ -18,6 +19,8 @@ static cell AMX_NATIVE_CALL amx_pev(AMX *amx,cell *params)
return 0; return 0;
} }
} }
#endif
CHECK_ENTITY(index);
edict_t *pPlayer = INDEXENT2(index); edict_t *pPlayer = INDEXENT2(index);
int returntype = *params/sizeof(cell); int returntype = *params/sizeof(cell);
int valuetype=0; int valuetype=0;