Raised This Month: $ Target: $400
 0% 

Check if player is in radius of entity?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 05-31-2007 , 18:03   Re: Check if player is in radius of entity?
Reply With Quote #1

Hmm, I'm not sure why I get the tag mismatch then.

I'm trying to use engine too because the rest of my code is in engine.
hlstriker is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 05-31-2007 , 19:46   Re: Check if player is in radius of entity?
Reply With Quote #2

Here is the code I'm using that doesn't seem to work properly...

Code:
// Note that fOrigin1 and fOrigin2 are 2 different users current origins new entClass[32]; new playerNear, idNear; new Float:checkRadius = 75.0; new checkEnt = -1; while((checkEnt = find_ent_in_sphere(checkEnt, fOrigin1, checkRadius)) != 0) {     entity_get_string(checkEnt, EV_SZ_classname, entClass, 31);     if(containi(entClass, "item") || containi(entClass, "trigger") != -1)     {         playerNear = 1;     }     else     {         playerNear = 0;     } } checkEnt = -1; while((checkEnt = find_ent_in_sphere(checkEnt, fOrigin2, checkRadius)) != 0) {     entity_get_string(checkEnt, EV_SZ_classname, entClass, 31);     if(containi(entClass, "item") || containi(entClass, "trigger") != -1)     {         idNear = 1;     }     else     {         idNear = 0;     } } if(idNear == 1) {     // The player is near an item or trigger entity } else {     // The player isn't near an item or trigger entity } if(idNear == 1) {     // The player is near an item or trigger entity } else {     // The player isn't near an item or trigger entity }
hlstriker is offline
Reply



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 22:24.


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