AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Get entitys by class in distance around you (https://forums.alliedmods.net/showthread.php?t=20568)

Sandurr 11-11-2005 18:19

Get entitys by class in distance around you
 
Hi,

is it possible to get entitys by classname that are in a range around you


Like

for (range)
find_ent_by_classname(-1,"func_door")


for example

Mod= The Specialists


(P.S. Sorry for posting this same topic on the other forum, please delete that one !)

Hawk552 11-11-2005 18:48

http://www.amxmodx.org/funcwiki.php?go=func&id=349

v3x 11-11-2005 23:53

Boo, I like to do it oldskool 8)

Code:
#define MAX_DISTANCE    900 public my_func(id) {   new ent;   while((ent = find_ent_by_class(ent, "func_door")) != 0)   {     new distance = floatround(entity_range(id, ent));     if(distance <= MAX_DISTANCE)     {       client_print(id, 3, "Entity %i is within the max distance", ent);     }   } }

Sandurr 11-12-2005 05:15

Thanks, I hope it works out :)

Sandurr 11-12-2005 16:56

How come this doesn't find infodecal ?

XxAvalanchexX 11-12-2005 17:17

Because his find_ent_by_class only searches for func_door's.

Code:
 new ent, Float:origin[3], Float:radius;  while((ent = find_ent_in_sphere(ent,origin,radius)) != 0) {     new classname[32];     entity_get_string(ent,EV_SZ_classname,classname,31);     client_print(0,print_console,"%s (%d)^n",classname,ent);  }

origin and radius need a value.

SSJ2GOKU 11-12-2005 19:21

so if you would like to receive a player class use this, right?
Code:
 new ent, Float:origin[3], Float:radius;  while((ent = find_ent_in_sphere(ent,origin,radius)) != 0) {     new classname[32];     entity_get_int(ent,EV_INT_playerclass,classname,31);     client_print(0,print_console,"%s (%d)^n",classname,ent);  }
[/small]


All times are GMT -4. The time now is 23:44.

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