From 53d9274b4560665d5f0dc1e41f98e0cd06cd4ea4 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 1 Feb 2006 12:16:33 +0000 Subject: [PATCH] added pev_valid() --- dlls/fakemeta/pev.cpp | 17 ++++++++++++++++- dlls/fakemeta/sdk/amxxmodule.h | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/dlls/fakemeta/pev.cpp b/dlls/fakemeta/pev.cpp index a40b0c97..81ab91ef 100755 --- a/dlls/fakemeta/pev.cpp +++ b/dlls/fakemeta/pev.cpp @@ -613,7 +613,6 @@ static cell AMX_NATIVE_CALL amx_set_pev(AMX *amx, cell *params) if (iSwitch > pev_int_start && iSwitch < pev_int_end) { // Grrr... - int len; int iValue = blah[0]; switch(iSwitch) { @@ -1070,8 +1069,24 @@ static cell AMX_NATIVE_CALL amx_set_pev(AMX *amx, cell *params) return 0; } +static cell AMX_NATIVE_CALL amx_pev_valid(AMX *amx, cell *params) +{ + int idx = static_cast(params[1]); + + edict_t *e = INDEXENT(idx); + + if (FNullEnt(e)) + return 0; + + if (e->pvPrivateData) + return 2; + + return 1; +} + AMX_NATIVE_INFO pev_natives[] = { { "pev", amx_pev }, { "set_pev", amx_set_pev }, + { "pev_valid", amx_pev_valid }, {NULL, NULL}, }; diff --git a/dlls/fakemeta/sdk/amxxmodule.h b/dlls/fakemeta/sdk/amxxmodule.h index 85f7985d..3d20f50e 100755 --- a/dlls/fakemeta/sdk/amxxmodule.h +++ b/dlls/fakemeta/sdk/amxxmodule.h @@ -2026,7 +2026,7 @@ typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/); typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/); -typedef int (*PFN_SET_TEAM_INFO) (int /*player */, int /*teamid */, const char */*name */); +typedef int (*PFN_SET_TEAM_INFO) (int /*player */, int /*teamid */, const char * /*name */); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname;