Jump to content
  • 0

Locked Vehicles


prominentalex

Question

13 answers to this question

Recommended Posts

  • 0

_vehicle_0 = objNull;
if (true) then
{
  _this = createVehicle ["BAF_FV510_W", [4798.0381, 9780.9795, 0], [], 0, "CAN_COLLIDE"];
  _vehicle_0 = _this;
  _this setVehicleLock "LOCKED";
  _this setPos [4798.0381, 9780.9795, 0];
};
))))

That will only lock the vehicle using arma logic, and it will be gone after reboot...

Link to comment
Share on other sites

  • 0

Here you go buddy, sorry for the delay .. What I've done is created a menu system for adding vehicles and TP'ng people to your location which are the two you and another person asked for help with.. The rest is up to you :)

Make a folder in your mission directory called: custom\admintools <-- custom , then inside custom admintools

Now inside admintools make a file called adminmenu.sqf and paste this into it:
 

if ((getPlayerUID player) in ["1234567"]) then { // Replace 1234567 with your UID

AdminToolsMenu =
[
        ["Admin Tools Menu",true],  
			["TP Player To Me", [2], "", -5, [["expression", '[] execVM "custom\admintools\tp2me.sqf"']], "1", "1"],
			["Spawn Vehicle with Key", [3], "", -5, [["expression", '[] execVM "custom\admintools\vehiclemenu.sqf"']], "1", "1"],
     
                ["", [-1], "", -5, [["expression", ""]], "1", "0"],
                        ["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
];
showCommandingMenu "#USER:AdminToolsMenu";
};

Now create a file in admintools called tp2me.sqf and paste this into it:

//AlPMaker
_max = 10; snext = false; plist = []; pselect5 = "";
{if ((_x != player) && (getPlayerUID _x != "")) then {plist set [count plist, name _x];};} forEach entities "CAManBase";
{if ((count crew _x) > 0) then {{if ((_x != player) && (getPlayerUID _x != "")) then {plist set [count plist, name _x];};} forEach crew _x;};} foreach (entities "LandVehicle" + entities "Air" + entities "Ship");
smenu =
{
        _pmenu = [["",true]];
        for "_i" from (_this select 0) to (_this select 1) do
        {_arr = [format['%1', plist select (_i)], [12],  "", -5, [["expression", format ["pselect5 = plist select %1;", _i]]], "1", "1"]; _pmenu set [_i + 2, _arr];};
        if (count plist > (_this select 1)) then {_pmenu set [(_this select 1) + 2, ["Next", [13], "", -5, [["expression", "snext = true;"]], "1", "1"]];}
        else {_pmenu set [(_this select 1) + 2, ["", [-1], "", -5, [["expression", ""]], "1", "0"]];};
        _pmenu set [(_this select 1) + 3, ["Exit", [13], "", -5, [["expression", "pselect5 = 'exit';"]], "1", "1"]];
        showCommandingMenu "#USER:_pmenu";
};
_j = 0; _max = 10; if (_max>9) then {_max = 10;};
while {pselect5 == ""} do
{
        [_j, (_j + _max) min (count plist)] call smenu; _j = _j + _max;
        WaitUntil {pselect5 != "" or snext};        
        snext = false;
};
if (pselect5 != "exit") then
{
        _name = pselect5;
        {
                if(name _x == _name) then
                {
                        hint format ["Teleporting %1", _name];
                        _x attachTo [vehicle player, [2, 2, 0]];
                        sleep 0.25;
                        detach _x;
                };
        } forEach entities "CAManBase";
};

Now create a file in admintools called addvehicle.sqf and paste this into it:

private ["_worldspace","_charID","_veh","_location","_isOk","_vehtospawn","_part_in","_qty_in","_qty","_obj","_objectID","_objectUID","_started","_finished","_animState","_isMedic","_dir","_helipad","_removed","_keyColor","_keyNumber","_keySelected","_isKeyOK","_config","","_textPartIn","_textPartOut"];
 _vehtospawn = _this select 0; 
 _activatingPlayer = player;
 _charID = dayz_characterID;
 _dir = getdir vehicle player;
 _pos = getPos vehicle player;
 _pos = [(_pos select 0)+8*sin(_dir),(_pos select 1)+8*cos(_dir),0];
 _worldspace = [_dir,_pos];
 
cutText ["Starting Spawn, stand still to complete spawn.", "PLAIN DOWN"];
 
// First select key color
_keyColor = ["Green","Red","Blue","Yellow","Black"] call BIS_fnc_selectRandom;
 
// then select number from 1 - 2500
_keyNumber = (floor(random 2500)) + 1;
 
// Combine to key (eg.ItemKeyYellow2494) classname
_keySelected = format[("ItemKey%1%2"),_keyColor,_keyNumber]; 
 
_isKeyOK =  isClass(configFile >> "CfgWeapons" >> _keySelected);
 
_config = _keySelected;
_isOk = [player,_config] call BIS_fnc_invAdd;
waitUntil {!isNil "_isOk"};
if (_isOk and _isKeyOK) then {
 
_removed = ([player,_part_in,_qty_in] call BIS_fnc_invRemove);
_dir = round(random 360);
 
_helipad = nearestObjects [player, ["HeliHCivil","HeliHempty"], 100];
if(count _helipad > 0) then {
	_location = (getPosATL (_helipad select 0));
} else {
	_location = [(position player),0,20,1,0,2000,0] call BIS_fnc_findSafePos;
};
 
//place vehicle spawn marker (local)
_veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"];
 
_location = (getPosATL _veh);
 
PVDZE_veh_Publish2 = [_veh,[_dir,_location],_vehtospawn,false,_keySelected,_activatingPlayer];
publicVariableServer  "PVDZE_veh_Publish2";
player reveal _veh;
 
cutText [format[("Spawned a vehicle, key added to toolbelt."),_qty_in,_textPartIn,_textPartOut], "PLAIN DOWN"];
 
} else {
cutText ["You do not have enough room on your toolbelt.", "PLAIN DOWN"];
};

Now create a file in admintools called vehiclemenu.sqf and paste this into it:

if ((getPlayerUID player) in ["1234567"]) then {  // Replace 1234567 with your UID
AddVehicles = 
[
	["Add Vehicle",true],
	
		["Armoured SUV", [2], "", -5, [["expression", '["ArmoredSUV_PMC_DZE"] execVM "custom\admintools\addvehicle.sqf"']], "1", "1"],
		["UH 1H", [3], "", -5, [["expression", '["UH1H_DZE"] execVM "custom\admintools\addvehicle.sqf"']], "1", "1"],
		["Skoda", [4], "", -5, [["expression", '["Skoda"] execVM "custom\admintools\addvehicle.sqf"']], "1", "1"],
		["Humvee", [5], "", -5, [["expression", '["HMMWV_DZ"] execVM "custom\admintools\addvehicle.sqf"']], "1", "1"],
		["Motorbike", [6], "", -5, [["expression", '["Old_moto_TK_Civ_EP1"] execVM "custom\admintools\addvehicle.sqf"']], "1", "1"],
		["", [-1], "", -5, [["expression", ""]], "1", "0"],
			["Exit", [13], "", -3, [["expression", ""]], "1", "1"]
];

showCommandingMenu "#USER:AddVehicles";
};

Then in your init.sqf file (the root of your mission folder) , add this to the very end: execVM "custom\admintools\adminmenu.sqf";
 
You're done, repackage your mission.pbo and upload it.. 

I've made you cut and paste instead of just giving you the files so that you look at the code and see how it works.  You should be able to figure out how to add more menus and how to change the vehicles etc.. If you didnt already have a custom folder, then keep it as you'll be using it a lot if you intend on customising your mission often.

Link to comment
Share on other sites

  • 0

use this method on my server everything works fine)

 

No , I can promise you that just using that code will do nothing more than create a temporary locked vehicle (that's useless if yo can't unlock it, and I doubt he knows how to do that either).. Unless you're using more code too ?

Link to comment
Share on other sites

  • 0

@prominentalex: Got you confused with someone else due to the identical image as your avatar. Anyway, the code does show you how to do what you asked. This saves the vehicle to the database , gives you the key and locks it..

I already have that on my admin tools. I need to know how to create a vehicle that will be locked from the in game 3d editor

Link to comment
Share on other sites

  • 0

What, spawning in teh editor of course not..

 

I think the OP does want to spawn static vehicles with the ArmA editor and just lock it so nobody can take it and drive away or whatever use that has :;D

lol no...I know it doesnt save in the editor :P

 

The script i mean. I see this : PVDZE_veh_Publish2 and made me wonder what hell lies behind that variable :P

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...