diff --git a/amxmodx/amxmodx.cpp b/amxmodx/amxmodx.cpp index 33b010d5..ac6d79dc 100755 --- a/amxmodx/amxmodx.cpp +++ b/amxmodx/amxmodx.cpp @@ -214,7 +214,7 @@ static cell AMX_NATIVE_CALL console_print(AMX *amx, cell *params) /* 2 param */ { CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); - if (pPlayer->ingame) + if (pPlayer->ingame && !pPlayer->IsBot()) { if (len > 126) // Client console truncates after byte 127. (126 + \n = 127) { @@ -247,7 +247,7 @@ static cell AMX_NATIVE_CALL client_print(AMX *amx, cell *params) /* 3 param */ { CPlayer *pPlayer = GET_PLAYER_POINTER_I(i); - if (pPlayer->ingame) + if (pPlayer->ingame && !pPlayer->IsBot()) { g_langMngr.SetDefLang(i); msg = format_amxstring(amx, params, 3, len); @@ -280,7 +280,7 @@ static cell AMX_NATIVE_CALL client_print(AMX *amx, cell *params) /* 3 param */ CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); - if (pPlayer->ingame) + if (pPlayer->ingame && !pPlayer->IsBot()) { g_langMngr.SetDefLang(index); @@ -427,7 +427,7 @@ static cell AMX_NATIVE_CALL show_motd(AMX *amx, cell *params) /* 3 param */ { CPlayer* pPlayer = GET_PLAYER_POINTER_I(i); - if (pPlayer->ingame) + if (pPlayer->ingame && !pPlayer->IsBot()) UTIL_ShowMOTD(pPlayer->pEdict, sToShow, ilen, szHead); } } else { @@ -444,7 +444,7 @@ static cell AMX_NATIVE_CALL show_motd(AMX *amx, cell *params) /* 3 param */ CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); - if (pPlayer->ingame) + if (pPlayer->ingame && !pPlayer->IsBot()) UTIL_ShowMOTD(pPlayer->pEdict, sToShow, ilen, szHead); } @@ -524,7 +524,7 @@ static cell AMX_NATIVE_CALL show_hudmessage(AMX *amx, cell *params) /* 2 param * { CPlayer *pPlayer = GET_PLAYER_POINTER_I(i); - if (pPlayer->ingame) + if (pPlayer->ingame && !pPlayer->IsBot()) { g_langMngr.SetDefLang(i); message = UTIL_SplitHudMessage(format_amxstring(amx, params, 2, len)); @@ -551,7 +551,7 @@ static cell AMX_NATIVE_CALL show_hudmessage(AMX *amx, cell *params) /* 2 param * CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); - if (pPlayer->ingame) + if (pPlayer->ingame && !pPlayer->IsBot()) { if (aut) { @@ -787,22 +787,27 @@ static cell AMX_NATIVE_CALL is_user_alive(AMX *amx, cell *params) /* 1 param */ if (index < 1 || index > gpGlobals->maxClients) { - return 0; + return FALSE; } CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); + if (!pPlayer->ingame) + { + return FALSE; + } + if (g_bmod_tfc) { edict_t *e = pPlayer->pEdict; if (e->v.flags & FL_SPECTATOR || (!e->v.team || !e->v.playerclass)) { - return 0; + return FALSE; } } - return ((pPlayer->ingame && pPlayer->IsAlive()) ? 1 : 0); + return pPlayer->IsAlive() ? TRUE : FALSE; } static cell AMX_NATIVE_CALL get_amxx_verstring(AMX *amx, cell *params) /* 2 params */ @@ -1106,6 +1111,12 @@ static cell AMX_NATIVE_CALL user_has_weapon(AMX *amx, cell *params) } CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); + + if (!pPlayer->ingame) + { + return 0; + } + edict_t *pEntity = pPlayer->pEdict; if (params[3] == -1) @@ -1344,17 +1355,20 @@ static cell AMX_NATIVE_CALL show_menu(AMX *amx, cell *params) /* 3 param */ } else { CPlayer* pPlayer = GET_PLAYER_POINTER_I(index); - pPlayer->keys = keys; - pPlayer->menu = menuid; - pPlayer->vgui = false; + if (pPlayer->ingame) + { + pPlayer->keys = keys; + pPlayer->menu = menuid; + pPlayer->vgui = false; - if (time == -1) - pPlayer->menuexpire = INFINITE; - else - pPlayer->menuexpire = gpGlobals->time + static_cast(time); + if (time == -1) + pPlayer->menuexpire = INFINITE; + else + pPlayer->menuexpire = gpGlobals->time + static_cast(time); - pPlayer->page = 0; - UTIL_ShowMenu(pPlayer->pEdict, keys, time, sMenu, ilen); + pPlayer->page = 0; + UTIL_ShowMenu(pPlayer->pEdict, keys, time, sMenu, ilen); + } } return 1; diff --git a/amxmodx/emsg.cpp b/amxmodx/emsg.cpp index 2c76801b..9e6da0cf 100755 --- a/amxmodx/emsg.cpp +++ b/amxmodx/emsg.cpp @@ -87,6 +87,7 @@ void Client_TeamInfo(void* mValue) case 1: if (index < 1 || index > gpGlobals->maxClients) break; char* msg = (char*)mValue; + if (!msg) break; g_players[index].team = msg; g_teamsIds.registerTeam(msg, -1); g_players[index].teamId = g_teamsIds.findTeamId(msg); diff --git a/amxmodx/meta_api.cpp b/amxmodx/meta_api.cpp index e0b19859..6a4e10ad 100755 --- a/amxmodx/meta_api.cpp +++ b/amxmodx/meta_api.cpp @@ -1434,8 +1434,15 @@ int C_Cmd_Argc(void) // Only here we may find out who is an owner. void C_SetModel(edict_t *e, const char *m) { - if (e->v.owner && m[7]=='w' && m[8]=='_' && m[9]=='h') - g_grenades.put(e, 1.75, 4, GET_PLAYER_POINTER(e->v.owner)); + if (!m || strcmp(m, "models/w_hegrenade.mdl") != 0) + { + RETURN_META(MRES_IGNORED); + } + + if (e->v.owner) + { + g_grenades.put(e, 1.75f, 4, GET_PLAYER_POINTER(e->v.owner)); + } RETURN_META(MRES_IGNORED); } diff --git a/modules/cstrike/cstrike/CstrikeNatives.cpp b/modules/cstrike/cstrike/CstrikeNatives.cpp index 97cae380..fb973847 100644 --- a/modules/cstrike/cstrike/CstrikeNatives.cpp +++ b/modules/cstrike/cstrike/CstrikeNatives.cpp @@ -882,7 +882,7 @@ static cell AMX_NATIVE_CALL cs_set_user_model(AMX *amx, cell *params) GET_OFFSET("CBasePlayer", m_modelIndexPlayer); - char modelpath[260]; + char modelpath[PLATFORM_MAX_PATH]; ke::SafeSprintf(modelpath, sizeof(modelpath), "models/player/%s/%s.mdl", newModel, newModel); auto modelIndex = 0; diff --git a/modules/cstrike/cstrike/CstrikeUtils.cpp b/modules/cstrike/cstrike/CstrikeUtils.cpp index b0992f62..863b9d62 100644 --- a/modules/cstrike/cstrike/CstrikeUtils.cpp +++ b/modules/cstrike/cstrike/CstrikeUtils.cpp @@ -13,12 +13,13 @@ #include "amxxmodule.h" #include +#include extern int MessageIdTextMsg; bool UTIL_IsPlayer(edict_t *pPlayer) { - return strcmp(STRING(pPlayer->v.classname), "player") == 0; + return pPlayer && strcmp(STRING(pPlayer->v.classname), "player") == 0; } void UTIL_TextMsg_Generic(edict_t* pPlayer, const char* message) @@ -36,7 +37,7 @@ bool UTIL_CheckForPublic(const char *publicname) int i = 0; char blah[64]; - strncpy(blah, publicname, sizeof(blah) - 1); + ke::SafeStrcpy(blah, sizeof(blah), publicname); while ((amx = MF_GetScriptAmx(i++))) { diff --git a/modules/cstrike/cstrike/CstrikeUtils.h b/modules/cstrike/cstrike/CstrikeUtils.h index c5b9acdc..d0a7a2ec 100644 --- a/modules/cstrike/cstrike/CstrikeUtils.h +++ b/modules/cstrike/cstrike/CstrikeUtils.h @@ -49,6 +49,10 @@ void UTIL_StringToLower(const char *str, char *buffer, size_t maxlength); MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \ return 0; \ } \ + else if (!MF_GetPlayerEdict(x)->pvPrivateData) { \ + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (no private data)", x); \ + return 0; \ + } \ } else { \ if (x != 0 && FNullEnt(TypeConversion.id_to_edict(x))) { \ MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \ @@ -62,8 +66,12 @@ void UTIL_StringToLower(const char *str, char *buffer, size_t maxlength); MF_LogError(amx, AMX_ERR_NATIVE, "Player out of range (%d)", x); \ return 0; \ } else { \ - if (!MF_IsPlayerIngame(x) || FNullEnt(MF_GetPlayerEdict(x))) { \ - MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d", x); \ + if (!MF_IsPlayerIngame(x)) { \ + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (not in-game)", x); \ + return 0; \ + } \ + else if (!MF_GetPlayerEdict(x)->pvPrivateData) { \ + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid player %d (no private data)", x); \ return 0; \ } \ } diff --git a/modules/cstrike/csx/meta_api.cpp b/modules/cstrike/csx/meta_api.cpp index 19f0f495..f438d84f 100644 --- a/modules/cstrike/csx/meta_api.cpp +++ b/modules/cstrike/csx/meta_api.cpp @@ -178,14 +178,18 @@ void PlayerPreThink_Post( edict_t *pEntity ) { RETURN_META(MRES_IGNORED); } -void ServerDeactivate() { +void ServerDeactivate() +{ int i; - for( i = 1;i<=gpGlobals->maxClients; ++i){ - CPlayer *pPlayer = GET_PLAYER_POINTER_I(i); - if (pPlayer->rank) pPlayer->Disconnect(); + + for( i = 1; i <= gpGlobals->maxClients; ++i) + { + GET_PLAYER_POINTER_I(i)->Disconnect(); } - if ( (g_rank.getRankNum() >= (int)csstats_maxsize->value) || ((int)csstats_reset->value == 1 ) ) { - CVAR_SET_FLOAT("csstats_reset",0.0); + + if (static_cast(csstats_maxsize->value) <= 0 || g_rank.getRankNum() >= static_cast(csstats_maxsize->value) || static_cast(csstats_reset->value) != 0) + { + CVAR_SET_FLOAT("csstats_reset", 0.0f); g_rank.clear(); // clear before save to file } g_rank.saveRank( MF_BuildPathname("%s",get_localinfo("csstats")) ); @@ -197,27 +201,26 @@ void ServerDeactivate() { RETURN_META(MRES_IGNORED); } -BOOL ClientConnect_Post( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] ){ +BOOL ClientConnect_Post( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]) +{ CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity); - if (pPlayer->pEdict == NULL) - { - pPlayer->Init(ENTINDEX(pEntity), pEntity); - } - pPlayer->Connect(pszAddress); RETURN_META_VALUE(MRES_IGNORED, TRUE); } -void ClientDisconnect( edict_t *pEntity ) { - CPlayer *pPlayer = GET_PLAYER_POINTER(pEntity); - if (pPlayer->rank) pPlayer->Disconnect(); +void ClientDisconnect( edict_t *pEntity ) +{ + GET_PLAYER_POINTER(pEntity)->Disconnect(); + RETURN_META(MRES_IGNORED); } -void ClientPutInServer_Post( edict_t *pEntity ) { +void ClientPutInServer_Post( edict_t *pEntity ) +{ GET_PLAYER_POINTER(pEntity)->PutInServer(); + RETURN_META(MRES_IGNORED); } diff --git a/modules/engine/engine.cpp b/modules/engine/engine.cpp index 55506857..f574bfca 100644 --- a/modules/engine/engine.cpp +++ b/modules/engine/engine.cpp @@ -456,6 +456,13 @@ static cell AMX_NATIVE_CALL set_view(AMX *amx, cell *params) { plinfo[iIndex].iViewType = CAMERA_3RDPERSON; pNewCamera = CREATE_NAMED_ENTITY(MAKE_STRING("info_target")); + + if (!pNewCamera) + { + MF_LogError(amx, AMX_ERR_NATIVE, "Could not create camera entity."); + return 0; + } + pNewCamera->v.classname = MAKE_STRING("VexdCam"); SET_MODEL(pNewCamera, "models/rpgrocket.mdl"); @@ -486,6 +493,13 @@ static cell AMX_NATIVE_CALL set_view(AMX *amx, cell *params) { plinfo[iIndex].iViewType = CAMERA_UPLEFT; pNewCamera = CREATE_NAMED_ENTITY(MAKE_STRING("info_target")); + + if (!pNewCamera) + { + MF_LogError(amx, AMX_ERR_NATIVE, "Could not create camera entity."); + return 0; + } + pNewCamera->v.classname = MAKE_STRING("VexdCam"); SET_MODEL(pNewCamera, "models/rpgrocket.mdl"); @@ -516,6 +530,13 @@ static cell AMX_NATIVE_CALL set_view(AMX *amx, cell *params) { plinfo[iIndex].iViewType = CAMERA_TOPDOWN; pNewCamera = CREATE_NAMED_ENTITY(MAKE_STRING("info_target")); + + if (!pNewCamera) + { + MF_LogError(amx, AMX_ERR_NATIVE, "Could not create camera entity."); + return 0; + } + pNewCamera->v.classname = MAKE_STRING("VexdCam"); SET_MODEL(pNewCamera, "models/rpgrocket.mdl"); diff --git a/modules/fakemeta/fakemeta_amxx.h b/modules/fakemeta/fakemeta_amxx.h index 9b7b084b..6fb0518c 100644 --- a/modules/fakemeta/fakemeta_amxx.h +++ b/modules/fakemeta/fakemeta_amxx.h @@ -50,6 +50,16 @@ #define CHECK_ENTITY(x) if (x != 0 && (FNullEnt(TypeConversion.id_to_edict(x)) || x < 0 || x > gpGlobals->maxEntities)) { MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity"); return 0; } #define CHECK_OFFSET(x) if (x < 0) { MF_LogError(amx, AMX_ERR_NATIVE, "Invalid offset"); return 0; } +#define CHECK_ENTITY_PDATA(x) \ + if (FNullEnt(TypeConversion.id_to_edict(x))) { \ + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d", x); \ + return 0; \ + } \ + else if (!TypeConversion.id_to_edict(x)->pvPrivateData) { \ + MF_LogError(amx, AMX_ERR_NATIVE, "Invalid entity %d (no private data)", x); \ + return 0; \ + } + extern AMX_NATIVE_INFO engfunc_natives[]; extern AMX_NATIVE_INFO dllfunc_natives[]; diff --git a/modules/fakemeta/fm_tr.cpp b/modules/fakemeta/fm_tr.cpp index fa002c9e..6b735f06 100644 --- a/modules/fakemeta/fm_tr.cpp +++ b/modules/fakemeta/fm_tr.cpp @@ -86,7 +86,7 @@ static cell AMX_NATIVE_CALL set_tr(AMX *amx, cell *params) case TR_pHit: { e = TypeConversion.id_to_edict(*ptr); - if (!e || FNullEnt(e)) + if (*ptr != -1 && FNullEnt(e)) return 0; //TODO: return error gfm_tr->pHit = e; return 1; @@ -167,7 +167,7 @@ static cell AMX_NATIVE_CALL get_tr(AMX *amx, cell *params) } case TR_pHit: { - if (gfm_tr->pHit == NULL || FNullEnt(gfm_tr->pHit)) + if (FNullEnt(gfm_tr->pHit)) return -1; return ENTINDEX(gfm_tr->pHit); break; diff --git a/modules/fakemeta/fm_tr2.cpp b/modules/fakemeta/fm_tr2.cpp index e9305191..57db06c9 100644 --- a/modules/fakemeta/fm_tr2.cpp +++ b/modules/fakemeta/fm_tr2.cpp @@ -99,7 +99,7 @@ static cell AMX_NATIVE_CALL set_tr2(AMX *amx, cell *params) case TR_pHit: { edict_t *e = TypeConversion.id_to_edict(*ptr); - if (!e || FNullEnt(e)) + if (*ptr != -1 && FNullEnt(e)) return 0; //TODO: return error tr->pHit = e; return 1; @@ -187,7 +187,7 @@ static cell AMX_NATIVE_CALL get_tr2(AMX *amx, cell *params) } case TR_pHit: { - if (tr->pHit == NULL || FNullEnt(tr->pHit)) + if (FNullEnt(tr->pHit)) return -1; return ENTINDEX(tr->pHit); break; diff --git a/modules/fakemeta/misc.cpp b/modules/fakemeta/misc.cpp index 8c38c4c6..c6022444 100644 --- a/modules/fakemeta/misc.cpp +++ b/modules/fakemeta/misc.cpp @@ -18,7 +18,7 @@ static cell AMX_NATIVE_CALL copy_infokey_buffer(AMX *amx, cell *params) { char *infobuffer = reinterpret_cast(params[1]); - return MF_SetAmxString(amx, params[2], infobuffer, params[3]); + return MF_SetAmxString(amx, params[2], infobuffer ? infobuffer : "", params[3]); } // lookup_sequence(entid, "sequence name", &Float:framerate = 0.0, &bool:loops = false, &Float:groundspeed = 0.0); diff --git a/modules/fakemeta/pdata.cpp b/modules/fakemeta/pdata.cpp index b69dfbe0..870be62e 100644 --- a/modules/fakemeta/pdata.cpp +++ b/modules/fakemeta/pdata.cpp @@ -32,18 +32,18 @@ //implement these with setjmp later. bool IsBadReadPtr(void *l, size_t size) { - return false; + return l ? false : true; } bool IsBadWritePtr(void *l, size_t size) { - return false; + return l ? false : true; } #endif static cell AMX_NATIVE_CALL set_pdata_int(AMX *amx, cell *params) { int index=params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int iOffset=params[2]; CHECK_OFFSET(iOffset); @@ -65,7 +65,7 @@ static cell AMX_NATIVE_CALL set_pdata_int(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_pdata_int(AMX *amx, cell *params) { int index=params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int iOffset=params[2]; CHECK_OFFSET(iOffset); @@ -87,7 +87,7 @@ static cell AMX_NATIVE_CALL get_pdata_int(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_pdata_float(AMX *amx, cell *params) { int index=params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int iOffset=params[2]; CHECK_OFFSET(iOffset); @@ -109,7 +109,7 @@ static cell AMX_NATIVE_CALL set_pdata_float(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_pdata_float(AMX *amx, cell *params) { int index=params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int iOffset=params[2]; CHECK_OFFSET(iOffset); @@ -130,7 +130,7 @@ static cell AMX_NATIVE_CALL get_pdata_float(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_pdata_string(AMX *amx, cell *params) { int index=params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int iOffset=params[2]; CHECK_OFFSET(iOffset); @@ -167,7 +167,7 @@ static cell AMX_NATIVE_CALL get_pdata_string(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_pdata_string(AMX *amx, cell *params) { int index=params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int iOffset=params[2]; CHECK_OFFSET(iOffset); @@ -192,30 +192,35 @@ static cell AMX_NATIVE_CALL set_pdata_string(AMX *amx, cell *params) szData = get_pdata_direct(pEdict, iOffset); if (IsBadWritePtr(szData, 1)) return 0; - strcpy(szData, data); } else { szData = get_pdata(pEdict, iOffset); if (IsBadWritePtr(szData, 1)) return 0; - if (params[4] == 1) + + if (len > static_cast(strlen(szData))) { - free(szData); - szData = (char *)malloc(len + 1); - } else if (params[4] == 2) { - delete [] szData; - szData = new char[len + 1]; + if (params[4] == 1) + { + free(szData); + szData = (char *)malloc(len + 1); + } + else if (params[4] == 2) { + delete[] szData; + szData = new char[len + 1]; + } + set_pdata(pEdict, iOffset, szData); } - strcpy(szData, data); - set_pdata(pEdict, iOffset, szData); } + strncopy(szData, data, len + 1); + return 1; } static cell AMX_NATIVE_CALL get_pdata_ent(AMX *amx, cell *params) { int index=params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int iOffset=params[2]; CHECK_OFFSET(iOffset); @@ -256,7 +261,7 @@ static cell AMX_NATIVE_CALL get_pdata_ent(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_pdata_ent(AMX *amx, cell *params) { int index = params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int offset = params[2]; CHECK_OFFSET(offset); @@ -282,7 +287,7 @@ static cell AMX_NATIVE_CALL set_pdata_ent(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_pdata_bool(AMX *amx, cell *params) { int index = params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int offset = params[2]; CHECK_OFFSET(offset); @@ -303,7 +308,7 @@ static cell AMX_NATIVE_CALL get_pdata_bool(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_pdata_bool(AMX *amx, cell *params) { int index = params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int offset = params[2]; CHECK_OFFSET(offset); @@ -328,7 +333,7 @@ static cell AMX_NATIVE_CALL set_pdata_bool(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_pdata_byte(AMX *amx, cell *params) { int index = params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int offset = params[2]; CHECK_OFFSET(offset); @@ -349,7 +354,7 @@ static cell AMX_NATIVE_CALL get_pdata_byte(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_pdata_byte(AMX *amx, cell *params) { int index = params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int offset = params[2]; CHECK_OFFSET(offset); @@ -374,7 +379,7 @@ static cell AMX_NATIVE_CALL set_pdata_byte(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_pdata_short(AMX *amx, cell *params) { int index = params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int offset = params[2]; CHECK_OFFSET(offset); @@ -395,7 +400,7 @@ static cell AMX_NATIVE_CALL get_pdata_short(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_pdata_short(AMX *amx, cell *params) { int index = params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int offset = params[2]; CHECK_OFFSET(offset); @@ -420,7 +425,7 @@ static cell AMX_NATIVE_CALL set_pdata_short(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_pdata_vector(AMX *amx, cell *params) { int index = params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int offset = params[2]; CHECK_OFFSET(offset); @@ -449,7 +454,7 @@ static cell AMX_NATIVE_CALL get_pdata_vector(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_pdata_vector(AMX *amx, cell *params) { int index = params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int offset = params[2]; CHECK_OFFSET(offset); @@ -476,7 +481,7 @@ static cell AMX_NATIVE_CALL set_pdata_vector(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_pdata_ehandle(AMX *amx, cell *params) { int index = params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int offset = params[2]; CHECK_OFFSET(offset); @@ -524,7 +529,7 @@ static cell AMX_NATIVE_CALL get_pdata_ehandle(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_pdata_ehandle(AMX *amx, cell *params) { int index = params[1]; - CHECK_ENTITY(index); + CHECK_ENTITY_PDATA(index); int offset = params[2]; CHECK_OFFSET(offset); diff --git a/modules/fakemeta/pdata_entities.cpp b/modules/fakemeta/pdata_entities.cpp index 039e3fca..c2420264 100644 --- a/modules/fakemeta/pdata_entities.cpp +++ b/modules/fakemeta/pdata_entities.cpp @@ -18,7 +18,7 @@ static cell AMX_NATIVE_CALL get_ent_data(AMX *amx, cell *params) { int entity = params[1]; - CHECK_ENTITY(entity); + CHECK_ENTITY_PDATA(entity); TypeDescription data; GET_TYPE_DESCRIPTION(2, data, CommonConfig); @@ -33,7 +33,7 @@ static cell AMX_NATIVE_CALL get_ent_data(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_ent_data(AMX *amx, cell *params) { int entity = params[1]; - CHECK_ENTITY(entity); + CHECK_ENTITY_PDATA(entity); TypeDescription data; GET_TYPE_DESCRIPTION(2, data, CommonConfig); @@ -57,7 +57,7 @@ static cell AMX_NATIVE_CALL set_ent_data(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_ent_data_float(AMX *amx, cell *params) { int entity = params[1]; - CHECK_ENTITY(entity); + CHECK_ENTITY_PDATA(entity); TypeDescription data; GET_TYPE_DESCRIPTION(2, data, CommonConfig); @@ -72,7 +72,7 @@ static cell AMX_NATIVE_CALL get_ent_data_float(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_ent_data_float(AMX *amx, cell *params) { int entity = params[1]; - CHECK_ENTITY(entity); + CHECK_ENTITY_PDATA(entity); TypeDescription data; GET_TYPE_DESCRIPTION(2, data, CommonConfig); @@ -90,7 +90,7 @@ static cell AMX_NATIVE_CALL set_ent_data_float(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_ent_data_vector(AMX *amx, cell *params) { int entity = params[1]; - CHECK_ENTITY(entity); + CHECK_ENTITY_PDATA(entity); TypeDescription data; GET_TYPE_DESCRIPTION(2, data, CommonConfig); @@ -107,7 +107,7 @@ static cell AMX_NATIVE_CALL get_ent_data_vector(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_ent_data_vector(AMX *amx, cell *params) { int entity = params[1]; - CHECK_ENTITY(entity); + CHECK_ENTITY_PDATA(entity); TypeDescription data; GET_TYPE_DESCRIPTION(2, data, CommonConfig); @@ -125,7 +125,7 @@ static cell AMX_NATIVE_CALL set_ent_data_vector(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_ent_data_entity(AMX *amx, cell *params) { int entity = params[1]; - CHECK_ENTITY(entity); + CHECK_ENTITY_PDATA(entity); TypeDescription data; GET_TYPE_DESCRIPTION(2, data, CommonConfig); @@ -142,7 +142,7 @@ static cell AMX_NATIVE_CALL set_ent_data_entity(AMX *amx, cell *params) int entity = params[1]; int value = params[4]; - CHECK_ENTITY(entity); + CHECK_ENTITY_PDATA(entity); if (value != -1) { @@ -165,7 +165,7 @@ static cell AMX_NATIVE_CALL set_ent_data_entity(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_ent_data_string(AMX *amx, cell *params) { int entity = params[1]; - CHECK_ENTITY(entity); + CHECK_ENTITY_PDATA(entity); TypeDescription data; GET_TYPE_DESCRIPTION(2, data, CommonConfig); @@ -190,7 +190,7 @@ static cell AMX_NATIVE_CALL get_ent_data_string(AMX *amx, cell *params) static cell AMX_NATIVE_CALL set_ent_data_string(AMX *amx, cell *params) { int entity = params[1]; - CHECK_ENTITY(entity); + CHECK_ENTITY_PDATA(entity); TypeDescription data; GET_TYPE_DESCRIPTION(2, data, CommonConfig);