AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Find all entitys around player ? (https://forums.alliedmods.net/showthread.php?t=242426)

waza123a 06-19-2014 08:55

Find all entitys around player ?
 
How to find all entitys around the player ?

SpeeDeeR 06-19-2014 09:18

Re: Find all entitys around player ?
 
find_ent_in_sphere

Nextra 06-19-2014 17:36

Re: Find all entitys around player ?
 
For finding all entities inside the sphere you usually use the native like this:

PHP Code:

new ent = -1;
while ((
ent find_ent_in_sphere(entoriginradius)) {
   
// new entity found


This way you start with entity -1 which will return the first entity inside the sphere, and then work your way up until you found the last one.

hornet 06-19-2014 20:03

Re: Find all entitys around player ?
 
Quote:

Originally Posted by SpeeDeeR (Post 2154047)

Quote:

Originally Posted by Nextra (Post 2154267)
For finding all entities inside the sphere you usually use the native like this:

PHP Code:

new ent = -1;
while ((
ent find_ent_in_sphere(entoriginradius)) {
   
// new entity found


This way you start with entity -1 which will return the first entity inside the sphere, and then work your way up until you found the last one.

Better to use find_sphere_class() . That way the module performs the entity search and will be more efficient.

Nextra 06-19-2014 21:23

Re: Find all entitys around player ?
 
Quote:

Originally Posted by hornet (Post 2154311)
Better to use find_sphere_class() . That way the module performs the entity search and will be more efficient.

Well they are not the same thing. If you're not searching for a specific class but rather all entities around the player you can't use find_sphere_class. Otherwise you are correct though.

waza123a 06-20-2014 15:12

Re: Find all entitys around player ?
 
thanks all done.


All times are GMT -4. The time now is 21:13.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.