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.