Author Topic: Get all players positions  (Read 2654 times)

0 Members and 1 Guest are viewing this topic.

rbneville

  • Cheater Apprentice
  • *
  • Posts: 23
    • View Profile
Get all players positions
« on: June 11, 2012, 02:54:59 am »
Hey guys, I'm working on a code and need a little help. I need to be able to get the position of all other players on a server. Any advice on how to do this? I honestly have no clue where to start.

My code here makes a goat chase the local player (me) and after a set amount of time blows up.

This creates the goat and "explodes" it after a time.
Code: [Select]
_shelltype = "Sh_105_HE";
_veh = createVehicle ["Goat02_EP1" , position player, [], 0, "NONE"];
_move = _veh execVM "\Scripts\Move.sqf";
sleep 30;
terminate _spawn;
_pos = getpos player;
_shelltype createVehicle [_pos select 0, _pos select 1, (_pos select 2) +5]
deleteVehicle _veh;

This moves the goat with the player and also rotates the same as the player

Code: [Select]
while {1 == 1} do
{
_pos = getpos player;
_rot = getDir player;
_this setDir _rot;
_this setpos [_pos select 0, (_pos select 1) +2, (_pos select 2) +1]
};

All I need now is a way to get another players position.

leebeasley

  • Online Villain
  • ***
  • Posts: 115
  • Nyaaa!
    • View Profile
Re: Get all players positions
« Reply #1 on: June 11, 2012, 02:58:05 am »
Rofl, glorious script
I cut corners while running laps in gym class because I'm a fearless bastard.

zlake

  • Relentless Teamkiller
  • **
  • Posts: 76
  • Killer space clowns. Twas a movie.
    • View Profile
Re: Get all players positions
« Reply #2 on: June 11, 2012, 03:01:17 am »
Quote
nil = ["player setpos [getPos player select 0,getPos player select 1,(getPos player select 2)+10000];"]

Quote above is from the darky script that makes everyone move.

You could probably edit the map marker script instead of marking the map making a goat there instead.

Code: [Select]
hint "Adding Player Markers";

unitList = allUnits;
j = count unitList;
i = 0;
markPos = true;

while {markPos} do
{
unitList = allUnits;
j = count unitList;
i = 0;

for "i" from 0 to j do
{
unit = unitList select i;
pos = position unit;
};
sleep 0.5;
};
hint "Player Marking Stopping";

Right there than add your creation lines and if it works correctly everyone and yourself will have a goat chasing you around and blowing the fuck up.
« Last Edit: June 11, 2012, 03:07:52 am by zlake »

rbneville

  • Cheater Apprentice
  • *
  • Posts: 23
    • View Profile
Re: Get all players positions
« Reply #3 on: June 11, 2012, 03:10:46 am »
Most excellent zlake  :icon_devil
Thanks

zlake

  • Relentless Teamkiller
  • **
  • Posts: 76
  • Killer space clowns. Twas a movie.
    • View Profile
Re: Get all players positions
« Reply #4 on: June 11, 2012, 03:13:37 am »
You can even add a radius to the script. Make them spawn in random locations all over the map. When one gets close enough to a player. Like 400 yards. It will go all lee roy jakins on them.

robin-580

  • Online Villain
  • ***
  • Posts: 143
    • View Profile
Re: Get all players positions
« Reply #5 on: June 11, 2012, 03:39:50 am »
can you give the complete script please? icant get it to work dammed

zlake

  • Relentless Teamkiller
  • **
  • Posts: 76
  • Killer space clowns. Twas a movie.
    • View Profile
Re: Get all players positions
« Reply #6 on: June 11, 2012, 03:42:13 am »
Just put it together. Everything here is put on a platter for you to put together. Just Gotta move a few things around than bam. It should work as intended.

I too would like to be lazy and just have it handed to me but I'm going to work on it too since its for the exp. To lvl up you know.
« Last Edit: June 11, 2012, 03:52:23 am by zlake »

robin-580

  • Online Villain
  • ***
  • Posts: 143
    • View Profile
Re: Get all players positions
« Reply #7 on: June 11, 2012, 03:54:18 am »
i understand (;
i put everything together but i only get  the hint adding player markers when activated nothing happens  :icon_confused2

zlake

  • Relentless Teamkiller
  • **
  • Posts: 76
  • Killer space clowns. Twas a movie.
    • View Profile
Re: Get all players positions
« Reply #8 on: June 11, 2012, 03:56:24 am »
I'm still working on it myself. It helps to have  -showScriptErrors when you launch arma 2
atm I got it just spawning on myself.

robin-580

  • Online Villain
  • ***
  • Posts: 143
    • View Profile
Re: Get all players positions
« Reply #9 on: June 11, 2012, 03:58:17 am »
i see ca you please post it or pm me if you have it fully working its like 2 a clock midnight here and im lazy :icon_teehee

rbneville

  • Cheater Apprentice
  • *
  • Posts: 23
    • View Profile
Re: Get all players positions
« Reply #10 on: June 11, 2012, 04:00:26 am »
I think I did it, now off to the testing grounds.  :icon_devil
Its probably not the most efficient code as I used 3 different scripts. I will post if it works.

rbneville

  • Cheater Apprentice
  • *
  • Posts: 23
    • View Profile
Re: Get all players positions
« Reply #11 on: June 11, 2012, 04:11:49 am »
I haven't laughed so hard in a long time, let alone at a list of people who died.  :icon_laugh

So here's how to do it.
Create a folder in your Arma 2 OA folder called Scripts. Then add the following scripts to the folder then just load Spawn.sqf

Spawn.sqf
Code: [Select]
_unitList = allUnits;
j = count _unitList;
i = 0;
_markPos = true;

while {_markPos} do
{
_unitList = allUnits;
j = count _unitList;
i = 0;

for "i" from 0 to j do
{
_unit = _unitList select i;
_pos = position _unit;
_veh = createVehicle ["Goat02_EP1" , position player, [], 0, "NONE"];
_move = _veh execVM "\Scripts\Move.sqf";
sleep 30;
terminate _move;
_explode = _unit execVM "\Scripts\Explode.sqf";
sleep 0.5;
terminate _explode;

};
};

Move.sqf
Code: [Select]
hint "Evil Goat Attack Enabled";

_unitList = allUnits;
j = count _unitList;
i = 0;
_markPos = true;

while {_markPos} do
{
_unitList = allUnits;
j = count _unitList;
i = 0;

for "i" from 0 to j do
{
_unit = _unitList select i;
_pos = position _unit;
_this setpos [_pos select 0, (_pos select 1) -2, (_pos select 2) +1];

};
};

Explode.sqf
Code: [Select]
_shelltype = "Sh_105_HE";
_unitList = allUnits;
j = count _unitList;
i = 0;
_markPos = true;

while {_markPos} do
{
_unitList = allUnits;
j = count _unitList;
i = 0;

for "i" from 0 to j do
{
_unit = _unitList select i;
_pos = position _unit;
_shelltype createVehicle [_pos select 0, _pos select 1, (_pos select 2) +5];
};
};
« Last Edit: June 11, 2012, 04:51:50 am by rbneville »

zlake

  • Relentless Teamkiller
  • **
  • Posts: 76
  • Killer space clowns. Twas a movie.
    • View Profile
Re: Get all players positions
« Reply #12 on: June 11, 2012, 04:19:19 am »
Hmm that just kills everyone and brings a script error up on line 19 on the move.sqf gunna run it again for further testing.
« Last Edit: June 11, 2012, 04:25:06 am by zlake »

darkrounge

  • Online Villain
  • ***
  • Posts: 166
    • View Profile
Re: Get all players positions
« Reply #13 on: June 11, 2012, 04:22:47 am »
I guess you were in the same server when you demolished everything + killed everyone  :icon_devil

zlake

  • Relentless Teamkiller
  • **
  • Posts: 76
  • Killer space clowns. Twas a movie.
    • View Profile
Re: Get all players positions
« Reply #14 on: June 11, 2012, 04:26:02 am »
maybe. I'm doing small script changes as I'm working on it. Trying to get around some small errors. What he posted should work. But there is no goat.


Code: [Select]
_this setpos [_pos select 0, (_pos select 1) -2, (_pos select 2) +1];
You forgot the ; in the move sqf. That should fix it.