Raised This Month: $ Target: $400
 0% 

Finding certain entity in sphere


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 05-08-2016 , 17:05   Re: Finding certain entity in sphere
Reply With Quote #4

Code:
            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             }
This means that if you find one entity matching the classname that isn't yours it will return instantly, not even bothering checking any others.
You probably want to remove the "return" inside the if/else statement. Make a counter to see if you got any matches, display messages after the loop is complete, not during. You have got to let the loop finish completely. otherwise it will turn into a lottery.
__________________

Last edited by Black Rose; 05-08-2016 at 17:06.
Black Rose is offline
 



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 18:37.


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