Fixed bug at18250

This commit is contained in:
David Anderson 2005-09-02 03:44:15 +00:00
parent 27c80b00f8
commit 6636c20336

View File

@ -1404,7 +1404,8 @@ static cell AMX_NATIVE_CALL find_ent_by_model(AMX *amx, cell *params) {
edict_t *pStart; edict_t *pStart;
if (iStart == -1) { if (iStart == -1)
{
pStart = NULL; pStart = NULL;
} else { } else {
if (!is_ent_valid(iStart)) if (!is_ent_valid(iStart))
@ -1413,20 +1414,20 @@ static cell AMX_NATIVE_CALL find_ent_by_model(AMX *amx, cell *params) {
pStart = INDEXENT2(iStart); pStart = INDEXENT2(iStart);
} }
int checkEnt = ENTINDEX(FIND_ENTITY_BY_STRING(pStart, "classname", szClass)); edict_t *pEdict = FIND_ENTITY_BY_STRING(pStart, "classname", szClass);
const char *CheckModel = "";
while (!FNullEnt(checkEnt)) { const char *check;
CheckModel = STRING(pStart->v.model);
if (strcmp(CheckModel, szModel)==0) { while (pEdict && !FNullEnt(pEdict))
return checkEnt; {
} else { check = STRING(pEdict->v.model);
pStart = INDEXENT2(checkEnt); if (!check || strcmp(check, szModel))
checkEnt = ENTINDEX(FIND_ENTITY_BY_STRING(pStart, "classname", szClass)); pEdict = FIND_ENTITY_BY_STRING(pEdict, "classname", szClass);
} else
return ENTINDEX(pEdict);
} }
return checkEnt; return 0;
} }
static cell AMX_NATIVE_CALL find_ent_by_tname(AMX *amx, cell *params) { static cell AMX_NATIVE_CALL find_ent_by_tname(AMX *amx, cell *params) {