[Resolved] Get players in other players radius?
Hi, I thought I had this fixed, but it seems if more than 2 players are in the game it won't work or something.
What I am trying to do is have it give each player a radius. If it detects another player in the radius, they will both be set to SOLID_NOT. If it doesn't detect a player in the radius, they will be set to SOLID_BBOX. Here is the code i'm using now that doesn't work all the time (seems if more than 2 players are in it doesn't work). Code:
I then tried to use a suggestion with "find_sphere_class". This only gets the number of players I think though, and I need the players id. Here is the code I used for that... Code:
|
Re: Get players in other players radius?
for(new i = 0; i < num; i++)
Also this might help http://forums.alliedmods.net/showthread.php?t=42367 |
Re: Get players in other players radius?
Quote:
for(new i = 1; i <= num; i++) Also I'll check out that link, thanks. |
Re: Get players in other players radius?
No, you are skipping a player by doing that and on a 32 man server "i" could reach 32 causing errors with the players[32] array
|
Re: Get players in other players radius?
Oh ok, thanks :)
Also, that link to the Kz plugin is way to advanced for me, hehe. |
Re: Get players in other players radius?
Code:
//WRONGI will come up with a solution tomorrow. I don't have time today. |
Re: Get players in other players radius?
Alright thanks stupok69 :). I will love you forever if you can help me get this working hehe :P.
|
Re: Get players in other players radius?
Depending on what functionality you are looking for, you will have to modify this code. I set it up so that it checks every 2 seconds if a player is within the radius and makes them solid_not if they're within the radius.
If you want them to never collide, you can either lower the seconds for the set_task or use client_prethink/postthink. I would go with lowering the set_task seconds. Code:
This was fun to figure out :mrgreen:. Also, I think this may be more efficient then teame06's method used in his KZ plugin. It all depends on how the find_sphere_class() function works. |
Re: Get players in other players radius?
Thank you so so much, stupok69! You have no idea how much I appreciate this :)
|
| All times are GMT -4. The time now is 07:00. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.