GeneralTragedy Posted January 1, 2014 Report Share Posted January 1, 2014 Here's the add file for temp vehicles that go away on server restart: private ["_veh","_location","_isOk","_vehtospawn","_part_in","_qty_in","_qty","_obj","_objectID","_objectUID","_started","_finished","_animState","_isMedic","_dir","_removed","_keyColor","_keyNumber","_keySelected","_isKeyOK","_config","_textPartIn","_textPartOut"]; _vehtospawn = _this select 0; _dist = 10; _charID = dayz_characterID; _dir = getDir vehicle player; _pos = getPosATL vehicle player; _pos = [(_pos select 0)+_dist*sin(_dir),(_pos select 1)+_dist*cos(_dir),0]; _worldspace = [_dir,_pos]; cutText ["Starting Spawn, stand still to complete spawn.", "PLAIN DOWN"]; _location = _pos; _veh = createVehicle [_vehtospawn, _pos, [], 0, "CAN_COLLIDE"]; _veh setVariable ["Sarge",1,true]; clearMagazineCargoGlobal _veh; clearWeaponCargoGlobal _veh; cutText ["Spawned a vehicle.", "PLAIN DOWN"]; This is the add file for keyed vehicles: private ["_veh","_location","_isOk","_vehtospawn","_part_in","_qty_in","_qty","_obj","_objectID","_objectUID","_started","_finished","_animState","_isMedic","_dir","_removed","_keyColor","_keyNumber","_keySelected","_isKeyOK","_config","_textPartIn","_textPartOut"]; _vehtospawn = _this select 0; _dist = 10; _charID = dayz_characterID; _dir = getDir vehicle player; _pos = getPosATL vehicle player; _pos = [(_pos select 0)+_dist*sin(_dir),(_pos select 1)+_dist*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); _location = _pos; //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, player]; 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"]; }; And this is the add code for unkeyed vehicles (and, the one that kills my vendor menu for some reason).... private ["_veh","_location","_isOk","_vehtospawn","_part_in","_qty_in","_qty","_obj","_objectID","_objectUID","_started","_finished","_animState","_isMedic","_dir","_removed","_keyColor","_keyNumber","_keySelected","_isKeyOK","_config","_textPartIn","_textPartOut"]; _vehtospawn = _this select 0; _dist = 10; _charID = dayz_characterID; _dir = getDir vehicle player; _pos = getPosATL vehicle player; _pos = [(_pos select 0)+_dist*sin(_dir),(_pos select 1)+_dist*cos(_dir),0]; _worldspace = [_dir,_pos]; cutText ["Starting spawn, stand still to complete spawn.", "PLAIN DOWN"]; _location = _pos; //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,true,0,player]; publicVariableServer "PVDZE_veh_Publish2"; player reveal _veh; cutText [format[("Spawned a vehicle."),_qty_in,_textPartIn,_textPartOut], "PLAIN DOWN"]; Any thoughts? Link to comment Share on other sites More sharing options...
GeneralTragedy Posted January 1, 2014 Report Share Posted January 1, 2014 That's some great code to generate the dynamic list though. Thanks Halvhjearne ! If I can get this working, I'm going to try to implement the same thing for both skins and weapons. :) Note that I filtered out some additional things, so that you don't get the static objects (like searchlights, nests, base items, and the "pook" heli's... most of those things give you an error when you spawn them and some will kick you...). Also, some of the vehicles that remain in the list will still kick you because of battleye issues, so you may need to adjust your filters. But, it's still a massive list, and with my code above you can spawn temporary, keyed, and unkeyed versions of all of them (with the caveats I'm still trying to resolve of the duping if you don't exit the menu cleanly, and the issue with not being able to interact with traders if you spawn an unkeyed vehicle, until you restart the server.) Link to comment Share on other sites More sharing options...
axeman Posted January 1, 2014 Report Share Posted January 1, 2014 I suspect the issue with the 'No Key' cars is the key itself, or lack of. Looking at the trader code the boolean before the key code is there to specify no key. Try: PVDZE_veh_Publish2 = [_veh,[_dir,_location],_vehtospawn,true,0,_activatingPlayer]; Similar to the vehicle from config (above) have written one for weapons that selects the correct ammo and muzzles from cfgWeapons: https://github.com/andgregor/dayzepochweaponcrate is mixed in with an ammo crate script that adds other stuff but the principle is there.. Link to comment Share on other sites More sharing options...
Halvhjearne Posted January 2, 2014 Report Share Posted January 2, 2014 i have to ask this, even if some wil think its stupid ... but here goes ... 1 whats the point in "no key" vehicles anyway? 2 if you really do want a car with no key, why cant you just drop the key after you spawned it? i really dont understand that ... oh and btw, note that this spawn vehicle script defo need to some vars changed before using it ... some of these vars will ban you by both antihacks and battleye if you are not carefull! Link to comment Share on other sites More sharing options...
axeman Posted January 2, 2014 Report Share Posted January 2, 2014 Would be handy for admins to populate their server with default vehicles. I like to go round moving vehicles to a more natural place like a house driveway. Shame no one has yet come up with a damage vehicle script to make them require repair. A bit of random loot would be good too, the odd wheel that was previously scavanged before the owner got eaten. . Mostly all custom scripts will get you booted by battleye until exceptions are added. Nothing new about that. Link to comment Share on other sites More sharing options...
Halvhjearne Posted January 2, 2014 Report Share Posted January 2, 2014 Would be handy for admins to populate their server with default vehicles. I like to go round moving vehicles to a more natural place like a house driveway. Shame no one has yet come up with a damage vehicle script to make them require repair. A bit of random loot would be good too, the odd wheel that was previously scavanged before the owner got eaten. . oh, i didnt think of it like that ... i thought it was just lazy admins with keyoveride, that didnt wana spawn cars with a key, but yea i see the point now ... (but arnet default vehicles spawned in by another script than the vendor cars?) Mostly all custom scripts will get you booted by battleye until exceptions are added. Nothing new about that. yea i know, but not all custom scripts uses variables that are actively scanned for by antihacks like "selecteditem" or "vhnlist", thats why i mentioned it ... dont want anyone unrightfully kicked or banned :) Link to comment Share on other sites More sharing options...
GeneralTragedy Posted January 2, 2014 Report Share Posted January 2, 2014 i have to ask this, even if some wil think its stupid ... but here goes ... 1 whats the point in "no key" vehicles anyway? 2 if you really do want a car with no key, why cant you just drop the key after you spawned it? i really dont understand that ... oh and btw, note that this spawn vehicle script defo need to some vars changed before using it ... some of these vars will ban you by both antihacks and battleye if you are not carefull! To follow up on axeman's reply, the main benefits are you don't have to worry about losing the key, and the vehicle will persist across restarts (vs. the temporary vehicles...). Note that with the script you provided, you can spawn vehicles that aren't spawned by default by the game, and can control where they are spawned (vs. adding them to the allowed vehicles server spawn list...). So, you could do a "free-for-all tank battle" event for example, and have the reward be that the winner gets to keep their tank. Relative to the variables, I can easily change them (and that's probably a good idea). I just used what was in the script you provided already. :) I haven't worked with any anti-hacks besides the default battleye restrictions, so not really familiar with what "gets caught". GT Link to comment Share on other sites More sharing options...
GeneralTragedy Posted January 2, 2014 Report Share Posted January 2, 2014 I suspect the issue with the 'No Key' cars is the key itself, or lack of. Looking at the trader code the boolean before the key code is there to specify no key. Try: PVDZE_veh_Publish2 = [_veh,[_dir,_location],_vehtospawn,true,0,_activatingPlayer]; Similar to the vehicle from config (above) have written one for weapons that selects the correct ammo and muzzles from cfgWeapons: https://github.com/andgregor/dayzepochweaponcrate is mixed in with an ammo crate script that adds other stuff but the principle is there.. That's actually what I'm doing in the "unkeyed" section. Still for some reason, the vehicle "bugs" the trader menu (but not other ones, like the vehicle itself, etc.). This persists until I relog, and if I relog and then get back in the vehicle, the trader menu gets bugged again. Once the server restarts, the vehicle doesn't have that effect anymore... so, on restart the server is doing "something" to possibly finalize the vehicle, and then it works like all other unkeyed vehicle. Oddly, I have checked out the vehicle in the database both before and after restart, and there's no difference in it's entries that I can see. Odd... Checked out the weapon crate script, looks awesome and will definitely be useful, thanks! Link to comment Share on other sites More sharing options...
NateDaBeast Posted January 2, 2014 Report Share Posted January 2, 2014 I haven't tried this out yet but I hope it works ! Keep it up maybe even go bigger with the Admin tools and add in more things to it ! Link to comment Share on other sites More sharing options...
WEB11 Posted January 2, 2014 Report Share Posted January 2, 2014 Where can I get blue phoenix for Epoch chernarus? Link to comment Share on other sites More sharing options...
TeamSix Posted January 8, 2014 Report Share Posted January 8, 2014 Here's the code for my menu: // Adding temporary vehicles DynamicVehicles = [ ["",true], ["Get Temp Vehicle List", [2], "", -5, [["expression", format[_EXECscript5,"spawntempvehicle.sqf"]]], "1", "1"], ["Get UnKeyed Vehicle List", [3], "", -5, [["expression", format[_EXECscript5,"spawnunkeyedvehicle.sqf"]]], "1", "1"], ["Get Keyed Vehicle List", [4], "", -5, [["expression", format[_EXECscript5,"spawnkeyedvehicle.sqf"]]], "1", "1"], ["", [-1], "", -5, [["expression", ""]], "1", "0"], ["Exit", [13], "", -3, [["expression", ""]], "1", "1"] ]; this is the code I use to create the list... the only difference in this for each of the spawn files is the name of the "add" file I use. I'll upload each of those individually. #define KINDOF_ARRAY(a,b) [##a,##b] call {_veh = _this select 0;_types = _this select 1;_res = false; {if (_veh isKindOf _x) exitwith { _res = true };}forEach _types;_res} _n2sh = 10; _n2c = "Select Temp Vehicle:"; exitscript = true; selecteditem = ""; shnext = false; vhnlist = Nil; _veh = ""; if (isNil "vhnlist") then { vhnlist = []; _kindOf = ["Tracked","Wheeled","Air","Ship","Car","Truck","Motorcycle"]; _filter = ["BIS_Steerable_Parachute","ParachuteBase","Steerable_Parachute_EP1","pook_H13_Base"]; _cfgvehicles = configFile >> "cfgVehicles"; titleText ["Generating Vehicle List... Please Wait...","PLAIN DOWN"]; for "_i" from 0 to (count _cfgvehicles)-1 do { _vehicle = _cfgvehicles select _i; if (isClass _vehicle) then { _veh_type = configName(_vehicle); if ((getNumber(_vehicle >> "scope")==2) and (getText(_vehicle >> "picture")!="") and (KINDOF_ARRAY(_veh_type,_kindOf)) and !(KINDOF_ARRAY(_veh_type,_filter))) then { vhnlist set [count vhnlist,_veh_type]; }; }; }; titleText ["List is ready...","PLAIN DOWN"];titleFadeOut 5; }; shnext = false; shnmenu = { _pmenu = [["",true],[_n2c, [-1], "", -5, [["expression", ""]], "1", "0"]]; for "_i" from (_this select 0) to (_this select 1) do { _arr = [format['%1',vhnlist select (_i)], [_i - (_this select 0) + 2], "", -5, [["expression", format["selecteditem = vhnlist select %1;",_i]]], "1", "1"]; _pmenu set [_i+2, _arr]; }; _pmenu set [(_this select 1)+2, ["", [-1], "", -5, [["expression", ""]], "1", "0"]]; if (count vhnlist > (_this select 1)) then { _pmenu set [(_this select 1)+3, ["Next", [12], "", -5, [["expression", "shnext = true;"]], "1", "1"]]; } else { _pmenu set [(_this select 1)+3, ["", [-1], "", -5, [["expression", ""]], "1", "0"]]; }; _pmenu set [(_this select 1)+4, ["Exit", [13], "", -5, [["expression", "selecteditem = 'exitscript';"]], "1", "1"]]; showCommandingMenu "#USER:_pmenu"; }; _j=0; if (_n2sh>9) then {_n2sh=10; }; while {selecteditem==""} do { [_j,(_j+_n2sh) min (count vhnlist)] call shnmenu; _j=_j+_n2sh; WaitUntil { selecteditem!="" or shnext }; shnext = false; }; if (selecteditem != "exitscript" and selecteditem != "") then { [selecteditem] execVM "admintools\Vehicles\addtempvehicle.sqf"; }; all the "add" files in next post... Hey, i have installed your script and it works fine, but i have one big problem. I have implemented a delete script, but when i use it, the keyed vehicles are back after a server restart. Do somebody know, how i can delete the vehicles on the right way? _delobj = cursorTarget; deleteVehicle _delobj; cursorTarget setdamage 1; _dotxt = format["%1 Destroyed and Deleted", _delobj]; titleText [_dotxt,"PLAIN DOWN"]; titleFadeOut 4; Link to comment Share on other sites More sharing options...
Guest Posted January 8, 2014 Report Share Posted January 8, 2014 try like this: _target = cursorTarget; _objectID = _target getVariable ["ObjectID", "0"]; _objectUID = _target getVariable ["ObjectUID", "0"]; deleteVehicle _target; PVDZE_obj_Delete = [_objectID, _objectUID, player]; publicVariableServer "PVDZE_obj_Delete"; _dotxt = format["Deleted %1",_delobj]; titleText [_dotxt,"PLAIN DOWN"]; titleFadeOut 4; Link to comment Share on other sites More sharing options...
GeneralTragedy Posted January 9, 2014 Report Share Posted January 9, 2014 Where can I get blue phoenix for Epoch chernarus? https://github.com/BluePhoenix175/DayZ-Admin-Tools- Link to comment Share on other sites More sharing options...
GeneralTragedy Posted January 9, 2014 Report Share Posted January 9, 2014 try like this: _target = cursorTarget; _objectID = _target getVariable ["ObjectID", "0"]; _objectUID = _target getVariable ["ObjectUID", "0"]; deleteVehicle _target; PVDZE_obj_Delete = [_objectID, _objectUID, player]; publicVariableServer "PVDZE_obj_Delete"; _dotxt = format["Deleted %1",_delobj]; titleText [_dotxt,"PLAIN DOWN"]; titleFadeOut 4; Yes, the problem is the keyed vehicle is in the database, the code above should delete the database object. Although, if you're setting it's damage to 1 then as a destroyed vehicle, I would expect it to be deleted by cleanup anyway. Kind of odd. Link to comment Share on other sites More sharing options...
Halvhjearne Posted January 12, 2014 Report Share Posted January 12, 2014 Although, if you're setting it's damage to 1 then as a destroyed vehicle, I would expect it to be deleted by cleanup anyway. Kind of odd. if its deleted right after damage is set, it is most likely not updated to database first and will obviusly not be deleted there, then ... Link to comment Share on other sites More sharing options...
GeneralTragedy Posted January 12, 2014 Report Share Posted January 12, 2014 if its deleted right after damage is set, it is most likely not updated to database first and will obviusly not be deleted there, then ... Yep, makes sense. I've confirmed that the changes WaTTe suggested work great, however. :) Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now