Jump to content

[Release] Vehicle locator and key identifier


Logi

Recommended Posts

} forEach ['lbsetpicture','createDiaryRecord','createTask','createSimpleTask',
'buttonSetAction','processDiaryLink','createDiaryLink','lbSetData','createTeam','profileNamespace',
'exec','addGroupIcon','setGroupIconParams','markerText','setMarkerAlpha','setMarkerBrush','setMarkerColor',
'setMarkerDir','setMarkerPos','setMarkerShape','setMarkerSize','setMarkerText','setMarkerType','addWeaponCargo',
'addMagazineCargo','setVehicleAmmo','setVehicleAmmoDef','setWeaponReloadingTime','setVehicleInit','processInitCommands',
'addMPEventHandler','createVehicleLocal','setWaypointStatements','addWaypoint','toLower','toUpper','loadFile','rcallVarcode',
'saveStatus','loadStatus','saveVar','drawIcon','setMarkerDirLocal','setMarkerAlphaLocal','setMarkerPosLocal','setMarkerTextLocal','setMarkerTypeLocal',
'setMarkerColorLocal','setMarkerBrushLocal','setMarkerSizeLocal','setMarkerShapeLocal','createMarkerLocal'];

Then remove these from the list, or set them to false if yours looks like Better Dead Than Zed's:

'createMarkerLocal'

'setMarkerShapeLocal'
'setMarkerTypeLocal'
'setMarkerColorLocal'
'setMarkerSizeLocal'
'setMarkerTextLocal'

 

Then a couple of lines below that, you should see:

} forEach ['allUnits','entities','allMissionObjects','vehicles','playableUnits'];

Just remove 'vehicles' and the script should work for non-admin.

This is because my script uses a foreach loop on the array of vehicles to check if any of the CharacterID's match the key.

I will see if I can find a better solution to this when I have a chance.

 

The latest version of Infistar doesn't have the top section of code in it nor does it have that "forEach" line you posted. Line 1085 of the ah.sqf does have this:

} forEach ['closeDisplay','processInitCommands','setVehicleInit','removeAllEventHandlers','addEventHandler','allowDamage','Entities','typeName',
'forceEnd','allMissionObjects','playableUnits','vehicles','PVAH_AdminRequest','PVAH_WriteLogRequest','endMission','failMission','agents','isDedicated','isServer'];

So that might be the part where you'd remove vehicles.

 

*edit* Removing Vehicles from that section made no difference.

Link to comment
Share on other sites

Yeah the version of the script that I looked at was very out-dated.

 

But basically the 'vehicles' command seems like the problem for Infistar users, it appears to be getting blocked.

My script is identifying the keys and the correct vehicle CharacterID, but it is this part that does not work for Infistar non admin:

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

It checks each vehicle on the server to see if the CharcterID matches the current key.

 

I tested the script using cursor target as the target vehicle rather than looping through the vehicles array and it did work for the target vehicle. The map marker showed on the map.

But it is pointless locating a vehicle if you need to be looking at the vehicle you want to locate.

 

Link to comment
Share on other sites

Have you tried

} count vehicles;

No but if I did try that, it would have just returned 1 vehicle (me), at least with AH0332 it does.

 

I just ran my script and modded it to place a local map marker at every vehicle regardless of the CharacterID. I don't know why I hadn't thought of that sooner.

It placed 1 map marker at my location saying: here is sniper.

So I had a little look and found this:

vehicles = [vehicle player];

That line was not in the older version that I saw earlier.

Link to comment
Share on other sites

I had a better chance to test this today with Infistar AH0332.

All I had to do was find and remove these lines from where Coco-Nuts and Better Dead mentioned:

createMarkerLocal='no';
setMarkerShapeLocal='no';
setMarkerTypeLocal='no';
setMarkerColorLocal='no';
setMarkerSizeLocal='no';
setMarkerTextLocal='no';

In older versions of Infistar, they may all look like this instead: createMarkerLocal='STR':

 

Then find this line:

vehicles = [vehicle player];

An replace it with this.

vehicles = vehicles;

I did not need to change anything else.

Hopefully this might work for the latest version as well. I will need to test it.

 

 

Link to comment
Share on other sites

I had a better chance to test this today with Infistar AH0332.

All I had to do was find and remove these lines from where Coco-Nuts and Better Dead mentioned:

createMarkerLocal='no';
setMarkerShapeLocal='no';
setMarkerTypeLocal='no';
setMarkerColorLocal='no';
setMarkerSizeLocal='no';
setMarkerTextLocal='no';

 

I tested this will all of those changed to "yes" instead of removing them and made the other change and it's working properly now.

Link to comment
Share on other sites

Like I mentioned earlier, Infistar users do this at their own risk.

Doing this will prevent the local map marker commands and the vehicles command from being blocked by Infistar.

I am not aware of all the different exploits/hacks that are out there, but I don't think that this will cause much of an issue.

Link to comment
Share on other sites

Could you put up some instructions as to how to implement this without the use of Maca's Right Click system please ?

 

Do you have a custom server menu installed? You could add it to that.

Maca's Right Click system or a server menu are the best methods to run the script.

There are other ways to run the script but they are probably more difficult and less practical than the above options.

Link to comment
Share on other sites

do you use any other right click like deploy anything ??

I do have a extra_rc.hpp which I use to right click a radio to call the evacheli but when I add the code for the locate_vehicle.sqf script I don't get the option to right click the map like I do for the radio. My extra_rc.hpp looks like this without the code added.

class ExtraRc {
    class ItemRadio {
        class Use {
            text = "Call Evac-Chopper";
            script = "execVM 'custom\JAEM\CallEvacChopper.sqf'";
        };
    };
};

And looks like this with the code added.

class ExtraRc {
    class ItemRadio {
        class Use {
            text = "Call Evac-Chopper";
            script = "execVM 'custom\JAEM\CallEvacChopper.sqf'";
        };
    };
class ItemMap {
        class locate {
            text = "Locate Vehicles";
            script = "execVM 'scripts\locate_vehicle.sqf'";
        };
    };
};

I'm not sure if it's correct, the right click to call the helievac works perfect but not on the map :-(

Link to comment
Share on other sites

I have not seen that happen before.

Is there a vehicle in your database with the CharacterID 950?

 

Maybe the vehicle it originally belonged to has been deleted and the CharacterID has been issued to a door?

Or maybe they have the same CharcterID?

I had not really thought about this. I will have to test that scenario and maybe add a fix for it.

Thanks for making me aware of this.

Link to comment
Share on other sites

I do have a extra_rc.hpp which I use to right click a radio to call the evacheli but when I add the code for the locate_vehicle.sqf script I don't get the option to right click the map like I do for the radio. My extra_rc.hpp looks like this without the code added.

class ExtraRc {
    class ItemRadio {
        class Use {
            text = "Call Evac-Chopper";
            script = "execVM 'custom\JAEM\CallEvacChopper.sqf'";
        };
    };
};

And looks like this with the code added.

class ExtraRc {
    class ItemRadio {
        class Use {
            text = "Call Evac-Chopper";
            script = "execVM 'custom\JAEM\CallEvacChopper.sqf'";
        };
    };
class ItemMap {
        class locate {
            text = "Locate Vehicles";
            script = "execVM 'scripts\locate_vehicle.sqf'";
        };
    };
};

I'm not sure if it's correct, the right click to call the helievac works perfect but not on the map :-(

looks good as long as you placed locate_vehicle.sqf in your scripts folder

 

and as logi said, your not trying with the debugmap

Link to comment
Share on other sites

The key thingy makes perfect sense: "ItemKeyGreen950" maps to characterID 950, so I suppose all green keys are problematic.

 

The DB function FindVehicleKeysCount shows offsets of 2500 between key colors and PHive's key generator is of the opinion that ItemKeyGreen100 maps to CharID100, but 99 does not map.

 

Iirc there is an Epoch array variable holding all buildables, so perhaps check the returned classname (I guess you'll get more than 1 return) against that?

Link to comment
Share on other sites

I have just gotten around to updating the script to fix the bug that BetterDeadThanZed discovered.

Now it checks the type of vehicle to make sure that it is either an "Air", "Ship" or "LandVehicle".

 

I also realised that it would make a lot more sense to have a single modifiable script rather than having a separate script for the people who do not want the map markers.

So I have added a config section at the top of the script.

Now you only need to modify this variable to either true or false depending on whether you want the map markers to show or not:

_showMapMarker = True;   

 

I have also added this variable to make it easier for people to choose the colour of the map markers:

_markerColour = "ColorOrange";    // Alternatives = "ColorBlack", "ColorRed", "ColorGreen", "ColorBlue", "ColorYellow", "ColorWhite"

 

If you have previously installed this script, you should download the new version. You only need to replace the locate_vehicle.sqf file.

If you were previously using the identify keys only script, then you should update the script with the new one and just set the _showMapMarker variable to false:

_showMapMarker = False;

 

 

Link to comment
Share on other sites

Anyone working on a fix for more than one vehicle on the same key ?

 

I get this when I try to download the file..

 

Sorry, you can't view or download this file at this time.

Too many users have viewed or downloaded this file recently. Please try accessing the file again later. If the file you are trying to access is particularly large or is shared with many people, it may take up to 24 hours to be able to view or download the file. If you still can't access a file after 24 hours, contact your domain administrator.

Link to comment
Share on other sites

I will install the masterkey script on my test server and give it a go, I have just been trying to sort the Infistar issue first.

 

I was able to get a little look at the infistar script and I think that there should be a very simple solution to get this working with Infistar for non-admin.

I must warn you that this may make your server more vulnerable to exploits or hackers that may use the local map marker or vehicles commands.

Information on the vehicles command can be found here: https://community.bistudio.com/wiki/vehicles

Basically you do what Coco-Nuts suggested and find this bit of code in your AH.sqf file.

} forEach ['lbsetpicture','createDiaryRecord','createTask','createSimpleTask',
'buttonSetAction','processDiaryLink','createDiaryLink','lbSetData','createTeam','profileNamespace',
'exec','addGroupIcon','setGroupIconParams','markerText','setMarkerAlpha','setMarkerBrush','setMarkerColor',
'setMarkerDir','setMarkerPos','setMarkerShape','setMarkerSize','setMarkerText','setMarkerType','addWeaponCargo',
'addMagazineCargo','setVehicleAmmo','setVehicleAmmoDef','setWeaponReloadingTime','setVehicleInit','processInitCommands',
'addMPEventHandler','createVehicleLocal','setWaypointStatements','addWaypoint','toLower','toUpper','loadFile','rcallVarcode',
'saveStatus','loadStatus','saveVar','drawIcon','setMarkerDirLocal','setMarkerAlphaLocal','setMarkerPosLocal','setMarkerTextLocal','setMarkerTypeLocal',
'setMarkerColorLocal','setMarkerBrushLocal','setMarkerSizeLocal','setMarkerShapeLocal','createMarkerLocal'];

Then remove these from the list, or set them to false if yours looks like Better Dead Than Zed's:

'createMarkerLocal'

'setMarkerShapeLocal'
'setMarkerTypeLocal'
'setMarkerColorLocal'
'setMarkerSizeLocal'
'setMarkerTextLocal'

 

Then a couple of lines below that, you should see:

} forEach ['allUnits','entities','allMissionObjects','vehicles','playableUnits'];

Just remove 'vehicles' and the script should work for non-admin.

This is because my script uses a foreach loop on the array of vehicles to check if any of the CharacterID's match the key.

I will see if I can find a better solution to this when I have a chance.

Thx for looking .

 

I'm not using infistar so that won't be a problem

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
×
×
  • Create New...