Raised This Month: $32 Target: $400
 8% 

Entity and radius


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kiske
Veteran Member
Join Date: May 2009
Old 06-14-2014 , 08:43   Entity and radius
Reply With Quote #1

Hi,
I have a problem with an entity and his radius.


PHP Code:
set_task(0.1"entityThink"entity__"a"100);

public 
entityThink(const entity) {
static 
Float:vecEntityOrigin[3];
static 
Float:vecIdOrigin[3];
static 
iEnt;

entity_get_vector(iEntEV_VEC_originvecEntityOrigin);
iEnt = -1;

while((
iEnt find_ent_in_sphere(iEntvecEntityOrigin330.0)) != 0) {
if(!
is_user_alive(iEnt)) {
continue;
}

entity_get_vector(iEntEV_VEC_originvecIdOrigin);

if(
get_distance_f(vecIdOriginvecEntityOrigin) > 300.0) {
set_user_godmode(iEnt0);
continue;
}

set_user_godmode(iEnt1);
}

The result of that code it's this (example, view of top):






Buuuut, what happens when there are two entities like this close enough, something like that (example, view of top):



The 'User with problem' has godmode for the 'Entity 1' and hasn't godmode for the 'Entity 2'.

How to fix that ?
__________________


Last edited by hornet; 06-14-2014 at 09:40. Reason: It is a violation of the forum rules to blank out your post
Kiske is offline
Send a message via Skype™ to Kiske
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 06-14-2014 , 09:03   Re: Entity and radius
Reply With Quote #2

I don't really see the problem.

The user gets godmode, isn't that the point?

This is completely useless:
Code:
    while((iEnt = find_ent_in_sphere(iEnt, vecEntityOrigin, 330.0)) != 0) {         // ...
        entity_get_vector(iEnt, EV_VEC_origin, vecIdOrigin);
        if(get_distance_f(vecIdOrigin, vecEntityOrigin) > 300.0) {
__________________

Last edited by Black Rose; 06-14-2014 at 09:03.
Black Rose is offline
Kiske
Veteran Member
Join Date: May 2009
Old 06-14-2014 , 09:25   Re: Entity and radius
Reply With Quote #3

Quote:
Originally Posted by Black Rose View Post
I don't really see the problem.

The user gets godmode, isn't that the point?

This is completely useless:
Code:
while((iEnt = find_ent_in_sphere(iEnt, vecEntityOrigin, 330.0)) != 0) { // ...
 entity_get_vector(iEnt, EV_VEC_origin, vecIdOrigin);
 if(get_distance_f(vecIdOrigin, vecEntityOrigin) > 300.0) {
If I remove that, the user always will have godmode, even if not in range.
__________________


Last edited by hornet; 06-14-2014 at 09:41. Reason: It is a violation of the forum rules to blank out your post
Kiske is offline
Send a message via Skype™ to Kiske
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 06-14-2014 , 09:38   Re: Entity and radius
Reply With Quote #4

Please don't blank out your posts and show us what you did wrong.
__________________
In Flames we trust!
Nextra is offline
Kiske
Veteran Member
Join Date: May 2009
Old 06-14-2014 , 09:58   Re: Entity and radius
Reply With Quote #5

Quote:
Originally Posted by Nextra View Post
Please don't blank out your posts and show us what you did wrong.
It works, nothing more.
"Solved" (?
__________________


Last edited by Kiske; 06-14-2014 at 09:59.
Kiske is offline
Send a message via Skype™ to Kiske
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-14-2014 , 10:43   Re: Entity and radius
Reply With Quote #6

It work's, then let it here so others can learn from it and find a solution.
HamletEagle is offline
Kiske
Veteran Member
Join Date: May 2009
Old 06-14-2014 , 10:47   Re: Entity and radius
Reply With Quote #7

Quote:
Originally Posted by HamletEagle View Post
It work's, then let it here so others can learn from it and find a solution.
What solution ?
There was never an error, it was a misunderstanding.
__________________

Kiske is offline
Send a message via Skype™ to Kiske
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-14-2014 , 11:21   Re: Entity and radius
Reply With Quote #8

Doesn't metter, don't blank your post.
HamletEagle is offline
Kiske
Veteran Member
Join Date: May 2009
Old 06-14-2014 , 11:29   Re: Entity and radius
Reply With Quote #9

Ok.
__________________

Kiske is offline
Send a message via Skype™ to Kiske
Reply


Thread Tools
Display Modes

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 03:48.


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