Finding Entities in a Sphere?
I'm trying to find all the vaildentites in my area, code:
Code:
|
Re: Finding Entities in a Sphere?
ent = total // you assign zero to ent
pev(ent, pev_classname, classname, 31) if you have just 3 strings, then you don't need loop. this is slow. why not just use fakemeta_util only. |
Re: Finding Entities in a Sphere?
Quote:
Code:
Also, i checked what the classname was returning, I either got 'player' or 'bodyque' when i was near a npc. |
Re: Finding Entities in a Sphere?
I'm not too sure, but I think the origin is supposed to be a float, and add the while loop back, I'm pretty sure that part was correct.
|
Re: Finding Entities in a Sphere?
so your npc's classname is not monster_*, you should set their classname to monster_* when your create them
Code:
|
Re: Finding Entities in a Sphere?
Uh-oh, my name's in that code, this can't be good... Anyway, the first code should always be telling you 0, since you never assign "total" a value. This is what I would do:
Code:
Changes (from first code): I get "origin" as a float, as it should be. I'm surprised that the other code didn't crash or something (Fakemeta is usually very picky). I create "i" outside of any loops, as you only need to create it one time. I add to "total" instead of assigning it the value of the last entity index found. Then I display "total" outside of the loops, since it only needs to be shown once. |
Re: Finding Entities in a Sphere?
Quote:
http://forums.alliedmods.net/showpos...10&postcount=6 |
| All times are GMT -4. The time now is 00:35. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.