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(iEnt, EV_VEC_origin, vecEntityOrigin);
iEnt = -1;
while((iEnt = find_ent_in_sphere(iEnt, vecEntityOrigin, 330.0)) != 0) {
if(!is_user_alive(iEnt)) {
continue;
}
entity_get_vector(iEnt, EV_VEC_origin, vecIdOrigin);
if(get_distance_f(vecIdOrigin, vecEntityOrigin) > 300.0) {
set_user_godmode(iEnt, 0);
continue;
}
set_user_godmode(iEnt, 1);
}
}
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 ?
__________________