Raised This Month: $ Target: $400
 0% 

find all entity in sphere


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
steve139
Senior Member
Join Date: May 2007
Location: here
Old 09-03-2008 , 07:47   find all entity in sphere
Reply With Quote #1

hello , i wanted to find all entity id in a small sphere
and after check if the entity can be take

so i did that to find all entity



PHP Code:
public fm_find_ent_in_sphere2(Float:origin[3], Float:range) {
    new 
ent 0
    
    
while((ent engfunc(EngFunc_FindEntityInSphereentoriginrange)) != 0)
    {
        if((
is_allowed_ent(ent) )) {
            return 
ent
        
}
        else {
            
ent 0
        
}
    }
    return 
PLUGIN_CONTINUE

but while the function to find ent is lunched , server got freezed
this is the function to check if the entity is allowed

PHP Code:
is_allowed_ent(entid) {
    new 
classname[33]
    
pev(entid,pev_classname,classname,32)
    
    if(
equal(classname,"tf_weapon_caltrop"))
        return 
1
    
else if(equal(classname,"tf_weapon_concussiongrenade"))
        return 
1
    
else if(equal(classname,"tf_weapon_normalgrenade"))
        return 
1
    
else if(equal(classname,"tf_weapon_nailgrenade"))
        return 
1
    
else if(equal(classname,"tf_weapon_mirvgrenade"))
        return 
1
    
else if(equal(classname,"tf_weapon_mirvbomblet"))
        return 
1
    
else if(equal(classname,"tf_weapon_napalmgrenade"))
        return 
1
    
else if(equal(classname,"tf_weapon_empgrenade"))
        return 
1
    
else if(equal(classname,"building_dispenser"))
        return 
1
    
else if(equal(classname,"building_teleporter"))
        return 
1
    
else if(equal(classname,"tf_gl_pipebomb"))
        return 
1
    
else if(equal(classname,"tf_gl_grenade"))
        return 
1
    
else if(equal(classname,"tf_weapon_gasgrenade"))
        return 
1
    
else if(equal(classname,"tf_weapon_caltrop"))
        return 
1
    
else if(equal(classname,"player"))
        return 
1
    
else if(equal(classname,"monster_turret"))
        return 
1
    
else if(equal(classname,"monster_miniturret"))
        return 
1
    
else if(equal(classname,"monster_sentry"))
        return 
1
    
else if(equal(classname,"detpack"))
        return 
1

    
return 0


anyone can help ?
in advance thank you
steve139 is offline
 


Thread Tools
Display Modes

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 03:07.


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