AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Radius around a player (https://forums.alliedmods.net/showthread.php?t=162004)

Doc-Holiday 07-13-2011 19:05

Radius around a player
 
I have found a few different methods of doing this but none of them really what im looking for..

I need one where i can set a radius around certain players if they match a class.

The ones i have found and tested.. i cant seem to place the radius around a single player.

Help with code or just keywords to search would be greatly appreciated :)

Thanks

!Morte 07-13-2011 20:14

Re: Radius around a player
 
Use FindEntityInSphere

Doc-Holiday 07-16-2011 03:15

Re: Radius around a player
 
So... i played around using that FindEntityInSphere... and found a tut by Jor.. i belive...

for some reason it finds all entities just fine but cant seem to pick up the class "player"..

any one know of some examples i can look at when i searched for that in "Scripting" only like 4 threads where there

i believe its because it only gets the closest ent... i need all of the "player" ents. in the sphere.

fysiks 07-16-2011 03:45

Re: Radius around a player
 
IIRC, you have to loop through the entites using the find ent in sphere function.

Doc-Holiday 07-16-2011 04:05

Re: Radius around a player
 
Quote:

Originally Posted by fysiks (Post 1511681)
IIRC, you have to loop through the entites using the find ent in sphere function.

https://forums.alliedmods.net/showth...EntityInSphere

Thats what i found. but it seems to only find the closest one.

ConnorMcLeod 07-16-2011 06:21

Re: Radius around a player
 
Doesn't find_sphere_class work ?
(It also uses FIND_ENTITY_IN_SPHERE so if that one doesn't work the other one should fail in the same way...).

Also, if you only need to retrieve players, just use get_players native and check entity_range.

Doc-Holiday 07-16-2011 07:35

Re: Radius around a player
 
1 Attachment(s)
Quote:

Originally Posted by ConnorMcLeod (Post 1511739)
Doesn't find_sphere_class work ?
(It also uses FIND_ENTITY_IN_SPHERE so if that one doesn't work the other one should fail in the same way...).

Also, if you only need to retrieve players, just use get_players native and check entity_range.

Thanks for the info about entity_range... thats what im using like the attatched plugin... does exactly what i want it to do :)

**Might not be the most efficient way**

bibu 07-16-2011 07:40

Re: Radius around a player
 
Sorry for asking something other. Can someone tell me the difference between these 2 natives?

http://www.amxmodx.org/funcwiki.php?go=func&id=397

http://www.amxmodx.org/funcwiki.php?go=func&id=330

Arkshine 07-16-2011 07:48

Re: Radius around a player
 
That's something you could find by yourself... You see get_entity_distance is an engine stock, and since you know you have to search before posting (you know right?) you go to engine_stocks.inc and you see what -magic- return floatround(entity_range(ent1, ent2)); and you have your answer.

bibu 07-16-2011 08:21

Re: Radius around a player
 
Quote:

Originally Posted by Arkshine (Post 1511787)
(you know right?)

Nope.


All times are GMT -4. The time now is 01:03.

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