AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Find sphere class help (https://forums.alliedmods.net/showthread.php?t=47400)

The Specialist 11-16-2006 23:55

Find sphere class help
 
I need help with using entity_get_vector() and find_sphere_class(). I want to get the origon of an entity by using the entity get vector , then pass that origon to the find_sphere_class. But im getting all sorts of errors with the paramters im passing. I already went and read documentation and Hawks tutorial on entities. But I cant seem to make this work. Can someone show me the proper way to do what im asking? Thanks guys :cry:

XxAvalanchexX 11-17-2006 01:56

Re: Entity Get Vector
 
Code:
new Float:origin[3]; entity_get_vector(entity,EV_VEC_origin,origin);

Notice that you have to create origin as a float and as a three-dimensional array. Is that what you were having trouble with, or was it more specifically find_sphere_class?

The Specialist 11-17-2006 02:01

Re: Entity Get Vector
 
i figured out that part . but i think i used origin wrong becasue im getting a tag mismatch warning. also i have a question about the find_sphere_cllass. Is it possable to get the id's or index's returned by the find_sphere_class ? I want to find all players out of radious and execute a function on them. find_sphere_class only returns the number of entitys found right ? i need the ids or indexes of the returned.

VEN 11-17-2006 03:13

Re: Find sphere class help
 
num_of_ents_in_entlist = find_sphere_class(0, "player", Float_radius, int_array_entlist, integer_maxents_of_entlist, Float_3Darray_origin)
You specify radius, maxents and origin.

The Specialist 11-17-2006 03:16

Re: Find sphere class help
 
yes i have that part already. but what i need is a way to execute a function on every player that i DONT find in that radious. so any players out side of the radious have code executed on them . any ideas ? thanks again :wink:

jim_yang 11-17-2006 03:44

Re: Find sphere class help
 
you mean to find a way that all the time check if they are out of the radious?

The Specialist 11-17-2006 03:53

Re: Find sphere class help
 
yes basicly. :wink:

VEN 11-17-2006 03:54

Re: Find sphere class help
 
Actually i'd not use find_sphere_class for that at all.
You always could do it without engine using for example get_players with "a" flag (if you want to check only alive players) and check the distance to the given origin with for example get_user_origin and get_distance[_f].

The Specialist 11-17-2006 03:59

Re: Find sphere class help
 
hmmm briliant ! lol. ill have to do that instead. would it be more efficaint then trying to run it through the engine with a set ttask?

EDIT : actually , i dont think i can becasue i need to be able to get get the diistance from the bomb to players. and i belive i need the find_ent_by_class for that. :cry:

VEN 11-17-2006 05:22

Re: Find sphere class help
 
You can do
PHP Code:

entlist_entnum find_sphere_class(bomb_entid"player"float_radiusint_array_entlistint_maxents_of_entlist

Then get all alive players and exclude ones that in the entlist array.
By this way you'll get all alive player indexes whose outside the given sphere.

Also you can do
PHP Code:

// loop through all alive players
if (entity_range(bombplayer) > radius// you're looking for this player(s) 



All times are GMT -4. The time now is 06:52.

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