Raised This Month: $ Target: $400
 0% 

Finding Entities in a Sphere?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Drak
Veteran Member
Join Date: Jul 2005
Old 01-31-2007 , 22:07   Finding Entities in a Sphere?
Reply With Quote #1

I'm trying to find all the vaildentites in my area, code:
Code:
#include <amxmodx> #include <amxmisc> #include <fakemeta> #include <engine> #include <fakemeta_util> #define PLUGIN "Sphere Test" #define VERSION "1.0" #define AUTHOR "Blll" //Should this be global? new validents[3][256] = {     "monster_zombie",     "monster_scientist",     "monster_barney" } public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_concmd("amx_sphere","sphere") } public sphere(id) {     new origin[3],ent,total,classname[32]     get_user_origin(id,origin)     while((ent = engfunc(EngFunc_FindEntityInSphere,ent,origin,10.0)) != 0 ) {         entity_get_string(ent,EV_SZ_classname,classname,31); //How do i get Classname in FakeMeta?         for(new i=0;i<sizeof(validents);i++) { //Thanks for XxAvalanchexX for this             if(equali(validents[i],classname)) {                 ent = total                 //fm_set_rendering(ent,kRenderFxGlowShell,200,130,42,kRenderNormal,16) Render the ents                 console_print(id,"[DEBUG] Ents found: %d",total)                 break;             }         }     }     return PLUGIN_HANDLED }
The number doesn't return correctly, (Sphere Count) it's usually wrong. I tryed lowering the sphere radius and it still doesn't work correctly. It will keep returning a large, or a null number. When the rendering code in un-commented, it renders all the ents within "validents", but not in radius range.
Drak is offline
Send a message via MSN to Drak
 



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 00:35.


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