First of all code :
PHP Code:
public DetonateLasermine(id)
{
new EntityName[32];
new Float:origin[3]
pev(id,pev_origin,origin);
new ent = -1
ColorChat(id, RED, "^4[SkazzY LaserMine] ^1Plugin is ^3WORKING")
while((ent = find_ent_in_sphere(id,origin,512.0)) != 0) {
pev(ent, pev_classname, EntityName, 31)
if(equali(EntityName, ENT_CLASS_NAME))
{
if(pev(ent, LASERMINE_OWNER) != id)
{
ColorChat(id, RED, "^4[SkazzY LaserMine] ^1You don't have any lasermines in ^3RADIUS ^1of ^3512 ^1units")
return PLUGIN_HANDLED
}
else
{
PlaySound(ent, STOP_SOUND)
CreateExplosion(ent)
CreateDamage(ent, get_pcvar_float(g_LRDMG), get_pcvar_float(g_LRADIUS))
RemoveEntity(ent)
ColorChat(id, RED, "^4[SkazzY LaserMine] ^1You have succesfully ^3DETONATED ^1your lasermine")
return PLUGIN_HANDLED
}
}
ColorChat(id, RED, "^4[SkazzY LaserMine] ^1There are no lasermines in ^3RADIUS ^1of ^3512 ^1units")
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
Explain :
So first of all, this is just a part of modified LaserMine plugin (lasermine_023) which i didn't make, most of things are changed but nothing that is important in this exact function. For those who don't know this plugin, it sets a entity lasermine box that emits "light" and deals damage. What i am trying to do is detonate entity in radius of 512 units with conditions of its classname being "lasermine" == ENT_CLASS_NAME (ENT_CLASS_NAME is defined at the top of the code and that classname is set while creating lasermine), and it needs to be yours (LASERMINE_OWNER is defined and set same as ENT_CLASS_NAME).
Problem :
No matter where i go, how many lasers/entities surround it pops this message :
Code:
[SkazzY LaserMine] Plugin is WORKING
[SkazzY LaserMine] There are no lasermines in RADIUS of 512 units
Which means plugin did find entity but that entity isn't lasermine.
Same message appears if i go out of the map where there are no entities.