Raised This Month: $ Target: $400
 0% 

[Resolved] Get players in other players radius?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
stupok
Veteran Member
Join Date: Feb 2006
Old 12-08-2006 , 19:30   Re: Get players in other players radius?
Reply With Quote #8

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:
#include <amxmodx> #include <amxmisc> #include <engine> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "Kamil" new cvar_collisions new players[32], playersnum public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     cvar_collisions = register_cvar("no_collisions", "1")         start_preventing() } public start_preventing() {     if(!get_pcvar_num(cvar_collisions)) return PLUGIN_HANDLED         set_task(2.0, "all_players_function", 0, "", 0, "b") } public all_players_function() {     get_players(players, playersnum, "ah")         for(new i = 0; i < playersnum; i++)     {         prevent_collide(players[i])     } } public prevent_collide(id) {     new origin[3]     new player[1]     new Float:radius = 100.0         get_user_origin(id, origin, 0)         find_sphere_class(id, "player", radius, player, 1)         if(id != player[0])     {         entity_set_int(id, EV_INT_solid, SOLID_NOT)         entity_set_int(player[0], EV_INT_solid, SOLID_NOT)     }     else     {         entity_set_int(id, EV_INT_solid, SOLID_BBOX)     } }

This was fun to figure out . 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.

Last edited by stupok; 12-08-2006 at 19:43.
stupok is offline
 



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 07:00.


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