Home   Help Search Login Register  

Author Topic: Need help to located a player every 5 min.  (Read 1698 times)

0 Members and 1 Guest are viewing this topic.

Offline cutter

  • Members
  • *
Need help to located a player every 5 min.
« on: 03 Oct 2009, 14:00:54 »
Thing is, i have a mission, blufor need to escort a rockstar to airport, opfor needs to eliminate him, the whole Chernarus is in use, so what i need is a small script to located the position of the rockstart everu 5 min or so, and report that to opfor, otherwise it will be to difficult for opfor to find him.

To be noted, i am noob with scripting  :confused:

Offline tcp

  • Members
  • *
    • Violator Gaming
Re: Need help to located a player every 5 min.
« Reply #1 on: 03 Oct 2009, 19:18:51 »
<rockstarname> is whatever you put in name field of unit.

Add this to the end of init.sqf:
Code: [Select]
sleep 1;
if(side player == east) then {rockstarname execVM "tracker.sqf"};

Code: (tracker.sqf) [Select]
if(isServer && isDedicated) exitWith {};
private ["_unit","_marker"];
_unit = _this;

_marker = createMarkerLocal [format ["%1marker", _unit], getPos _unit];
_marker setMarkerTypeLocal "mil_unknown";
_marker setMarkerColorLocal "ColorBlack";
_marker setMarkerTextLocal "Last Known Pos";
while {alive _unit} do {
_marker setMarkerPosLocal (getPos _unit);
sleep 300; //5 minutes
};

In your tasks code, you can use:
<marker name='rockstarnamemarker'>rockstarname</marker>
« Last Edit: 04 Oct 2009, 01:17:59 by tcp »

Offline cutter

  • Members
  • *
Re: Need help to located a player every 5 min.
« Reply #2 on: 03 Oct 2009, 22:16:14 »
I greatly appriciate this, thanks alot mate.  :good:

UPDATE.

I tryed it and it almost work  :) , but its not updating, it puts the marker right at the start and thats fine, but thats it, it isnt updating or anything, and i did exactly as writte above.
« Last Edit: 03 Oct 2009, 23:02:46 by cutter »

Offline tcp

  • Members
  • *
    • Violator Gaming
Re: Need help to located a player every 5 min.
« Reply #3 on: 04 Oct 2009, 01:02:03 »
OK, I made two mistakes:
This needs two equal signs:
if(side player == east) then {rockstarname execVM "tracker.sqf"};
Needs isDedicated to support player hosting:
if(isServer && isDedicated) exitWith {};

It works for me now, changes are made above as well.

Also, interval is set to 5 minutes. Change sleep <seconds>; in tracker.sqf to make it shorter.
« Last Edit: 04 Oct 2009, 01:20:58 by tcp »

Offline cutter

  • Members
  • *
Re: Need help to located a player every 5 min.
« Reply #4 on: 04 Oct 2009, 01:39:49 »
I love you man  :)