Jump to content

Simple vehicle finder


Csus

Recommended Posts

I got tired of having to either scan the map with vehicle markers on or prowling the DB for a certain vehicle after someone complained they lost their vehicle so I made this.

I use infiSTAR, which has a feature where you can press ALT+F11 to launch a file called "admin_start.sqf" from your Arma2OA folder. I don't know if other antihack tools have a similar feature, so I'll say it's only of use to people with infiSTAR.

 

All you gotta do is stick their vehicle key in your toolbelt and chuck whatever keys you have already in your backpack then press ALT+F11 and it will instantly TP you to the vehicle.

 

I dunno how to use github or something similar so I'm sorry for the big chunk here.

Just save this in your "SteamApps\common\Arma 2 Operation Arrowhead" folder as "admin_start.sqf".

 

private ["_inv","_keys","_searchString","_keyCount","_ID","_targetPos","_found","_targetID","_targetColor","_finalID","_targetPosition","_toPosition","_targetVehicle","_pPos","_pDir","_moveMethod","_allowMoveInDriver"];
_inv = [player] call BIS_fnc_invString;
_found = 0;
_allowMoveInDriver = false;
_moveMethod = "MeToCar"; // "CarToMe"
{
    for "_i" from 1 to 2500 do {
        _searchString = format ["ItemKey%1%2",_x,str(_i)];
        if ((_searchString in _inv) && (_found != 1)) then {
            _targetColor = _x;
            _ID = str(_i);
            _found = 1;
        };
    };
} forEach ["Black","Yellow","Blue","Green","Red"];

if (_found == 0) exitWith { systemChat "No key found!";};

_ID = parseNumber _ID;
if (_targetColor == "Green") then { _finalID = _ID; };
if (_targetColor == "Red") then { _finalID = _ID + 2500; };
if (_targetColor == "Blue") then { _finalID = _ID + 5000; };
if (_targetColor == "Yellow") then { _finalID = _ID + 7500; };
if (_targetColor == "Black") then { _finalID = _ID + 10000; };
_found = 0;

{
    private ["_tID"];
    _tID = parseNumber (_x getVariable ["CharacterID","0"]);
    if ((_tID == _finalID) && (_found != 1)) then {
        _targetPosition = getPosATL _x;
        _targetVehicle = _x;
        _found = 1;
    };
} forEach vehicles;

if (_found == 0) exitWith { systemChat "The vehicle doesn't exist or you have too many keys!";};

if (_moveMethod == "MeToCar") then {
    _toPosition = [(_targetPosition select 0) + 3,(_targetPosition select 1) + 3,0];
    player setPos _toPosition;
    player setDir 230;
};
if (_moveMethod == "CarToMe") then {
    _pPos = getPosATL player;
    _pDir = getDir player;
    _targetVehicle setPos _pPos;
    _targetVehicle setDir _pDir;
};
if (_allowMoveInDriver) then {    
    _targetVehicle setVehicleLock "UNLOCKED";
    player moveInDriver _targetVehicle;
};
systemChat format ["Found: %1",typeOf _targetVehicle];
systemChat format ["ID: %1",_finalID];

Link to comment
Share on other sites

Hi, it should work regardless of map. I have had the same issue a number of times but the cause of that is because the vehicle doesn't exist.

Just make sure only the key you're searching for is on your toolbelt at that moment. If you keep getting the same results just let me know and i'll post up a slightly newer version of it, there's not much change in it but it works perfect for me so i guess it's worth a shot.

Link to comment
Share on other sites

  • 1 month later...

I like the idea for this but when ever i try it i end up in the middle of the ocean when i try to MeToCar, now the CarToMe Works but we have people who steal peoples vehicles on the server so i don't want to return it to the person it was stolen from fairly. I didn't changes to the script its self i was thinking of putting server side on the infistar menu but didn't know it that would work out to well so i thought i ask for any suggestions you got.

Link to comment
Share on other sites

hey, i really don;t know why it doesn't work out so well for other people. It always works perfect for me and that's exactly why I put the MeToCar option in, so you don't give vehicles back to thieves. all i can suggest is spawning a few cars in and trying it out in different variations to see what might be causing it. as for integrating it with infistar, i'd have no clue where to start, i've never really dug around in that too much.

im sorry you're having trouble with this

Link to comment
Share on other sites

i have better idea: 

rigth button on key, tp to car, tp car to me

Working, jast need GodMod:

private ["_inv","_keys","_searchString","_keyCount","_ID","_targetPos","_found","_targetID","_targetColor","_finalID","_targetPosition","_toPosition","_targetVehicle","_pPos","_pDir","_moveMethod","_allowMoveInDriver"];
_inv = [player] call BIS_fnc_invString;
_found = 0;
_allowMoveInDriver = false;
_moveMethod = "MeToCar"; // "CarToMe"
{
    for "_i" from 1 to 2500 do {
	    _searchString = format ["ItemKey%1%2",_x,str(_i)];
		if ((_searchString in _inv) && (_found != 1)) then {
			_targetColor = _x;
			_ID = str(_i);
			_found = 1;
		};
	};
} forEach ["Black","Yellow","Blue","Green","Red"];

if (_found == 0) exitWith { systemChat "No key found!";};

_ID = parseNumber _ID;
if (_targetColor == "Green") then { _finalID = _ID; };
if (_targetColor == "Red") then { _finalID = _ID + 2500; };
if (_targetColor == "Blue") then { _finalID = _ID + 5000; };
if (_targetColor == "Yellow") then { _finalID = _ID + 7500; };
if (_targetColor == "Black") then { _finalID = _ID + 10000; };
_found = 0;

{
    private ["_tID"];
	_tID = parseNumber (_x getVariable ["CharacterID","0"]);
	if ((_tID == _finalID) && (_found != 1)) then {
	    _targetPosition = getPosATL _x;
		_targetVehicle = _x;
		_found = 1;
	};
} forEach vehicles;

if (_found == 0) exitWith { systemChat "The vehicle doesn't exist or you have too many keys!";};

if (_moveMethod == "MeToCar") then {
	//_toPosition = [_targetPosition,1,10,1,1,20000,0] call BIS_fnc_findSafePos;
    player setPos _targetPosition;
};
if (_moveMethod == "CarToMe") then {
	_pPos = getPosATL player;
    _pDir = getDir player;
    _targetVehicle setPos _pPos;
    _targetVehicle setDir _pDir;
};
if (_allowMoveInDriver) then {    
	_targetVehicle setVehicleLock "UNLOCKED";
    player moveInDriver _targetVehicle;
};
systemChat format ["Found: %1",typeOf _targetVehicle];
systemChat format ["ID: %1",_finalID];
Link to comment
Share on other sites

the reason for this -

_toPosition = [_targetPosition,1,10,1,1,20000,0] call BIS_fnc_findSafePos;

is just in case the admin doesn't have god mode on, it won't tp them into the center of the vehicle and kill them.

and i didn't put this -

_uid = getPlayerUID player;
_adminlist = ["111111","2222222"]; 
if !(_uid in _adminlist) exitWith {cutText [format["U not admin"], "PLAIN DOWN"]};

in because it was never intended to be part of the mission file, thus not being usable by anybody else.

 

did you tp into the sky every time or did you only try it once? cause sometimes BIS_fnc_findSafePos fails and reverts to getMarkerPos "center".

simply running it again should take you where you want to be.

Link to comment
Share on other sites

Try reducing the 20000, something like:

_toPosition = [_targetPosition,1,10,1,1,5,0] call BIS_fnc_findSafePos;

Is supposed to be elevation but I have also found that I would appear miles in the sky as I guess it allows spawning up to 20000m ASL.

 

Also, when using BIS_fnc_findSafePos if it doesn't find a suitable spot you will get teleported to the middle of the map, roughly next to a red building in Stary Sobor. Often worth putting a check in for that location, not tested but pretty sure it is the same x,y,z every time.

 

Tweaking the 3rd array item helps if you having constant problems finding a good spot..

Link to comment
Share on other sites

@F507DMT

 

in hindsight, adding 2m to _targetPosition would be the best idea but i'd only been playing with code in arma for about a week at this point so i didn't know how to modify single elements of an array. i'm assuming you got it working though, so all is well :)

Link to comment
Share on other sites

the reason for this -

_toPosition = [_targetPosition,1,10,1,1,20000,0] call BIS_fnc_findSafePos;

is just in case the admin doesn't have god mode on, it won't tp them into the center of the vehicle and kill them.

and i didn't put this -

_uid = getPlayerUID player;
_adminlist = ["111111","2222222"]; 
if !(_uid in _adminlist) exitWith {cutText [format["U not admin"], "PLAIN DOWN"]};

in because it was never intended to be part of the mission file, thus not being usable by anybody else.

 

did you tp into the sky every time or did you only try it once? cause sometimes BIS_fnc_findSafePos fails and reverts to getMarkerPos "center".

simply running it again should take you where you want to be.

 

 

a simple coord adjuster

_pos = getPos _vehicle;
_x = _pos select 0;
_y = _pos select 1;

_posToTP = [_x+1,_y+1];

setPos player _posToTP

now we are 1m north east of our vic

Link to comment
Share on other sites

  • 2 months later...

I got tired of having to either scan the map with vehicle markers on or prowling the DB for a certain vehicle after someone complained they lost their vehicle so I made this.

I use infiSTAR, which has a feature where you can press ALT+F11 to launch a file called "admin_start.sqf" from your Arma2OA folder. I don't know if other antihack tools have a similar feature, so I'll say it's only of use to people with infiSTAR.

 

All you gotta do is stick their vehicle key in your toolbelt and chuck whatever keys you have already in your backpack then press ALT+F11 and it will instantly TP you to the vehicle.

 

I dunno how to use github or something similar so I'm sorry for the big chunk here.

Just save this in your "SteamApps\common\Arma 2 Operation Arrowhead" folder as "admin_start.sqf".

 

private ["_inv","_keys","_searchString","_keyCount","_ID","_targetPos","_found","_targetID","_targetColor","_finalID","_targetPosition","_toPosition","_targetVehicle","_pPos","_pDir","_moveMethod","_allowMoveInDriver"];
_inv = [player] call BIS_fnc_invString;
_found = 0;
_allowMoveInDriver = false;
_moveMethod = "MeToCar"; // "CarToMe"
{
    for "_i" from 1 to 2500 do {
        _searchString = format ["ItemKey%1%2",_x,str(_i)];
        if ((_searchString in _inv) && (_found != 1)) then {
            _targetColor = _x;
            _ID = str(_i);
            _found = 1;
        };
    };
} forEach ["Black","Yellow","Blue","Green","Red"];

if (_found == 0) exitWith { systemChat "No key found!";};

_ID = parseNumber _ID;
if (_targetColor == "Green") then { _finalID = _ID; };
if (_targetColor == "Red") then { _finalID = _ID + 2500; };
if (_targetColor == "Blue") then { _finalID = _ID + 5000; };
if (_targetColor == "Yellow") then { _finalID = _ID + 7500; };
if (_targetColor == "Black") then { _finalID = _ID + 10000; };
_found = 0;

{
    private ["_tID"];
    _tID = parseNumber (_x getVariable ["CharacterID","0"]);
    if ((_tID == _finalID) && (_found != 1)) then {
        _targetPosition = getPosATL _x;
        _targetVehicle = _x;
        _found = 1;
    };
} forEach vehicles;

if (_found == 0) exitWith { systemChat "The vehicle doesn't exist or you have too many keys!";};

if (_moveMethod == "MeToCar") then {
    _toPosition = [(_targetPosition select 0) + 3,(_targetPosition select 1) + 3,0];
    player setPos _toPosition;
    player setDir 230;
};
if (_moveMethod == "CarToMe") then {
    _pPos = getPosATL player;
    _pDir = getDir player;
    _targetVehicle setPos _pPos;
    _targetVehicle setDir _pDir;
};
if (_allowMoveInDriver) then {    
    _targetVehicle setVehicleLock "UNLOCKED";
    player moveInDriver _targetVehicle;
};
systemChat format ["Found: %1",typeOf _targetVehicle];
systemChat format ["ID: %1",_finalID];

 

 

Hey Csus, nice script.

I only started playing Epoch a couple of weeks ago and I decided to set up a dedicated server for me and my friends to play on.

A few players started coming onto our server and it wasn't long before the admin started receiving requests to find users lost vehicles.

That is what has lead me to this thread. I was looking to see if there was a vehicle locator script already available.

 

Your script works very well as an admin tool, but I want my users to be able to locate their own vehicles, so I have created a modified version of your script.

Instead of teleporting the vehicle to the player or teleporting the player to the vehicle, this script creates local map markers.

The script also works when multiple keys are in the players inventory.

 

http://youtu.be/0BwxnXttTr0

 

 

Would you mind if I release this script?

I will give you credit for the original code.

Link to comment
Share on other sites

Hey Csus, nice script.

I only started playing Epoch a couple of weeks ago and I decided to set up a dedicated server for me and my friends to play on.

A few players started coming onto our server and it wasn't long before the admin started receiving requests to find users lost vehicles.

That is what has lead me to this thread. I was looking to see if there was a vehicle locator script already available.

 

Your script works very well as an admin tool, but I want my users to be able to locate their own vehicles, so I have created a modified version of your script.

Instead of teleporting the vehicle to the player or teleporting the player to the vehicle, this script creates local map markers.

The script also works when multiple keys are in the players inventory.

 

http://youtu.be/0BwxnXttTr0

 

 

Would you mind if I release this script?

I will give you credit for the original code.

Nice =] 

Link to comment
Share on other sites

  • 2 weeks later...

I prefer this download: 

 

You can give your donators or just everyone playing on your server the link to that tool, so they can search by themselfes.

ALso a good thing is - if someone find a key on a dead body, they can check out the car and sell or destroy it. Or wait for the car to move on ;)

 

Greetings!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...