Raised This Month: $ Target: $400
 0% 

Get entitys by class in distance around you


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sandurr
Senior Member
Join Date: Aug 2005
Old 11-11-2005 , 18:19   Get entitys by class in distance around you
Reply With Quote #1

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 !)
Sandurr is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 11-11-2005 , 18:48  
Reply With Quote #2

http://www.amxmodx.org/funcwiki.php?go=func&id=349
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 11-11-2005 , 23:53  
Reply With Quote #3

Boo, I like to do it oldskool

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);     }   } }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Sandurr
Senior Member
Join Date: Aug 2005
Old 11-12-2005 , 05:15  
Reply With Quote #4

Thanks, I hope it works out
Sandurr is offline
Sandurr
Senior Member
Join Date: Aug 2005
Old 11-12-2005 , 16:56  
Reply With Quote #5

How come this doesn't find infodecal ?
Sandurr is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 11-12-2005 , 17:17  
Reply With Quote #6

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.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
SSJ2GOKU
Senior Member
Join Date: Oct 2005
Location: Belgium
Old 11-12-2005 , 19:21  
Reply With Quote #7

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]
SSJ2GOKU is offline
Send a message via MSN to SSJ2GOKU
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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