mirror of
https://github.com/rehlds/reapi.git
synced 2024-12-29 08:05:36 +03:00
rg_find_ent_by_owner: Change behavior (always start search from next entity)
This commit is contained in:
parent
d8045dae93
commit
8fa52b0295
@ -443,12 +443,12 @@ native rg_find_ent_by_class(start_index, const classname[], const bool:useHashTa
|
|||||||
/*
|
/*
|
||||||
* Finds an entity in the world using Counter-Strike's custom FindEntityByString wrapper, matching by owner.
|
* Finds an entity in the world using Counter-Strike's custom FindEntityByString wrapper, matching by owner.
|
||||||
*
|
*
|
||||||
* @param start_index Entity index to start searching from. -1 to start from the first entity
|
* @param start_index Entity index to start searching from. AMX_NULLENT (-1) to start from the first entity
|
||||||
* @param classname Classname to search for
|
* @param classname Classname to search for
|
||||||
*
|
*
|
||||||
* @return 1 if found, 0 otherwise
|
* @return true if found, false otherwise
|
||||||
*/
|
*/
|
||||||
native rg_find_ent_by_owner(&start_index, const classname[], owner);
|
native bool:rg_find_ent_by_owner(&start_index, const classname[], owner);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Finds the weapon by name in the player's inventory.
|
* Finds the weapon by name in the player's inventory.
|
||||||
|
@ -613,12 +613,12 @@ cell AMX_NATIVE_CALL rg_find_ent_by_class(AMX *amx, cell *params)
|
|||||||
/*
|
/*
|
||||||
* Finds an entity in the world using Counter-Strike's custom FindEntityByString wrapper, matching by owner.
|
* Finds an entity in the world using Counter-Strike's custom FindEntityByString wrapper, matching by owner.
|
||||||
*
|
*
|
||||||
* @param start_index Entity index to start searching from. -1 to start from the first entity
|
* @param start_index Entity index to start searching from. AMX_NULLENT (-1) to start from the first entity
|
||||||
* @param classname Classname to search for
|
* @param classname Classname to search for
|
||||||
*
|
*
|
||||||
* @return 1 if found, 0 otherwise
|
* @return true if found, false otherwise
|
||||||
*
|
*
|
||||||
* native rg_find_ent_by_owner(&start_index, const classname[], owner);
|
* native bool:rg_find_ent_by_owner(&start_index, const classname[], owner);
|
||||||
*/
|
*/
|
||||||
cell AMX_NATIVE_CALL rg_find_ent_by_owner(AMX *amx, cell *params)
|
cell AMX_NATIVE_CALL rg_find_ent_by_owner(AMX *amx, cell *params)
|
||||||
{
|
{
|
||||||
@ -629,12 +629,14 @@ cell AMX_NATIVE_CALL rg_find_ent_by_owner(AMX *amx, cell *params)
|
|||||||
char classname[256];
|
char classname[256];
|
||||||
|
|
||||||
cell& startIndex = *getAmxAddr(amx, params[arg_start_index]);
|
cell& startIndex = *getAmxAddr(amx, params[arg_start_index]);
|
||||||
|
startIndex = clamp(startIndex, AMX_NULLENT, gpGlobals->maxEntities - 1);
|
||||||
|
|
||||||
const char* value = getAmxString(amx, params[arg_classname], classname);
|
const char* value = getAmxString(amx, params[arg_classname], classname);
|
||||||
edict_t* pOwner = edictByIndexAmx(params[arg_onwer]);
|
edict_t* pOwner = edictByIndexAmx(params[arg_onwer]);
|
||||||
edict_t* pEntity = g_pEdicts + startIndex;
|
|
||||||
|
|
||||||
for (int i = startIndex; i < gpGlobals->maxEntities; i++, pEntity++)
|
for (int i = startIndex + 1; i < gpGlobals->maxEntities; i++)
|
||||||
{
|
{
|
||||||
|
edict_t *pEntity = edictByIndex(i);
|
||||||
if (pEntity->v.owner != pOwner)
|
if (pEntity->v.owner != pOwner)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user