Results 1 to 3 of 3

Thread: how would I go about detecting number of players near a player?

  1. #1

    how would I go about detecting number of players near a player?

    I'm completely unsure of how I'd go about doing this, I want to somehow detect if X number of players are near eachother.. serverside.. any clues?

  2. #2
    PHP Code:
    {
        if(
    isPlayer _xthen {
            private [
    "_cnt""_plr"];
            
    _plr _x;
            
    _cnt 0;
            {
                if(
    isPlayer _xthen {
                    
    _cnt _cnt 1;
                };
            } forEach 
    nearestObjects [_x, ["Man"], 50];

            
    hint format ["%1 players around %2", (_cnt 1), name _plr];
        };
    } forEach 
    allUnits
    Didn't actually test the code, but it should work. This cycles through all players and counts players around them and puts number into _cnt. It will include player himself (so it is _cnt - 1 players around him). 50 is radius to check around each player.
    Last edited by SaMatra; Aug 12 2012 at 07:13.

  3. #3
    Thanks for the example I'll work with it and see if I can get my script to work!

Similar Threads

  1. Detecting Player Movement?
    By Urbansausage in forum ARMA 2 & OA : MISSIONS - Editing & Scripting
    Replies: 4
    Last Post: May 28 2012, 18:19
  2. Enemy density by number of players
    By VanhA in forum ARMA - MISSION EDITING & SCRIPTING
    Replies: 3
    Last Post: Aug 9 2008, 08:12
  3. detecting player has entered vehicle?
    By Hoot1988 in forum ARMA - MISSION EDITING & SCRIPTING
    Replies: 4
    Last Post: Sep 6 2007, 20:39
  4. Maximum Number of Players
    By CouchMonkey in forum ARMA - MULTIPLAYER
    Replies: 42
    Last Post: Mar 28 2007, 19:15
  5. Detecting unit's group number (1-12)
    By DanAK47 in forum OFP : MISSION EDITING & SCRIPTING
    Replies: 7
    Last Post: Jan 26 2005, 17:31

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •