Raised This Month: $ Target: $400
 0% 

[Resolved] Get players in other players radius?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 12-07-2006 , 10:39   [Resolved] Get players in other players radius?
Reply With Quote #1

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:
    new players[32];     new num;     get_players(players, num, "a");     for(new i = 1; i <= num; i++) {         if( (is_user_alive(players[i]) && is_user_alive(id)) ) {             if(!(players[i] == id)) {                 new distance;                 new origin1[3], origin2[3];                 new radius = 95;                                 get_user_origin(players[i], origin1);                 get_user_origin(id, origin2);                 distance = get_distance(origin1, origin2);                 if(distance < radius) {                     entity_set_int(id, EV_INT_solid, SOLID_NOT);                     entity_set_int(players[i], EV_INT_solid, SOLID_NOT);                 } else {                     entity_set_int(id, EV_INT_solid, SOLID_BBOX);                     entity_set_int(players[i], EV_INT_solid, SOLID_BBOX);                 }             }         }     }

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:
    new players[32];     new num;         get_players(players, num);     for(new i = 1; i <= num; i++) {         new Float:origin[3];         new testplayer;         entity_get_vector(players[i], EV_VEC_origin, origin);         testplayer = find_sphere_class(0, "player", 100.0, players, 33, origin);         client_print(0, print_chat, "Players in radius... %d", testplayer);     }

Last edited by hlstriker; 12-08-2006 at 23:16. Reason: Resolved
hlstriker 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