shurix Posted January 17, 2015 Report Share Posted January 17, 2015 I found myself jumping around the map and cleaning-up abandoned vehicles with broken wheels/engine. I decided to write a script that adds a "Remove Vehicle" action to every vehicle on the map. Player needs to have a Jack for the script to work. Player comes to a vehicle (open or locked). Scroll mouse wheel to see Remove Vehicle action. Script gives 5 seconds for the player to change his mind. Vehicle is removed and change is pushed to the database. Depending on the amount of damage the script drops Vehicle Repair or Salvage Metal items instead of the vehicle. For larger vehicles like a helicopter or a support truck it also produces a Vehicle Repair Kit. Add this line into mpmissions\epoch.Altis\init.sqf //vehicle actions [] execVM "custom\vehicle_actions.sqf"; Here's the contents of custom\vehicle_actions.sqf systemChat(format["Vehicle Actions are loading. Please wait..."]); { _x addAction ["<t color=""#ff0000"">Remove vehicle</t>","custom\remove_vehicle.sqf",[_x],0,false,true,"",""]; } forEach (vehicles); systemChat(format["Finished loading Vehicle Actions"]); Here's the actual file that removes the vehicle. custom\remove_vehicle.sqf private ["_vehSlot","_hasToolbox","_mags","_percent","_vehiclePosition","_remainingDamage","_damage","_part05","_part02","_part01","_vehicle","_hitpoints","_vehSlot","_vehHiveKey","_VAL","_box"]; _vehicle = _this select 0; _vehicle_type = (typeOf _vehicle); _isTruck = _vehicle isKindOf "Support"; _isHeli = _vehicle isKindOf "Helicopter"; _partTruckHeli = "VehicleRepairLg"; _part05 = "VehicleRepair"; _part02 = "ItemCorrugatedLg"; _part01 = "ItemCorrugated"; _hasToolbox = false; _mags = magazines player; _hasToolbox = "JackKit" in _mags; _hitpoints = _vehicle call EPOCH_getHitpoints; _damage = damage _vehicle; _remainingDamage = 1 - _damage; _vehiclePosition = getPos _vehicle; //hint format["_damage=%1 \n _remainingDamage=%2 \n _hasToolbox=%3",_damage,_remainingDamage,_hasToolbox]; if (_hasToolbox) then { _cnt = 5; _locationPlayer = (getPosATL player); for "_p" from 1 to 5 do { systemChat(format ["WARNING! Removing vehicle in %1s - Move to cancel",_cnt]); if (player distance _locationPlayer > 0.2) then { systemChat("Removing vehicle canceled"); breakOut "exit"; }; sleep 1; _cnt = _cnt - 1; }; player playActionNow "Medic"; //systemChat(format["b4 deleting _vehicle=%1",_vehicle]); _vehSlot=_vehicle getVariable["VEHICLE_SLOT","ABORT"]; if(_vehSlot !="ABORT") then { removeFromRemainsCollector[_vehicle]; deleteVehicle _vehicle; _vehHiveKey=format["%1:%2",(call EPOCH_fn_InstanceID),_vehSlot]; _VAL=[]; ["Vehicle",_vehHiveKey,_VAL]call EPOCH_server_hiveSET; EPOCH_VehicleSlots pushBack _vehSlot; EPOCH_VehicleSlotCount=count EPOCH_VehicleSlots; publicVariable "EPOCH_VehicleSlotCount"; }; sleep 2; //systemChat(format["_vehiclePosition=%1",_vehiclePosition]); if (_remainingDamage > 0.1) then { _box = createVehicle ["groundWeaponHolder",[(_vehiclePosition select 0),(_vehiclePosition select 1),0.01], [], 0, "CAN_COLLIDE"]; _box setVariable ["ObjectID","1",true]; _box setVariable ["permaLoot",true]; }; while {_remainingDamage > 0.1} do { if ((_remainingDamage >= 0.1) && (_remainingDamage < 0.2)) then { _box addMagazineCargoGlobal [_part01, 1]; //systemChat "added ItemCorrugated"; _remainingDamage = _remainingDamage - ((random 3)/10); }; if ((_remainingDamage >= 0.2) && (_remainingDamage <= 0.5)) then { _box addMagazineCargoGlobal [_part02, 1]; //systemChat "added ItemCorrugatedLg"; _remainingDamage = _remainingDamage - ((random 5)/10); }; if (_remainingDamage > 0.5) then { if ((_isTruck) || (_isHeli)) then { _box addMagazineCargoGlobal [_partTruckHeli, 1]; //systemChat "added VehicleRepairLg"; }; _box addMagazineCargoGlobal [_part05, 1]; //systemChat "added VehicleRepair"; _remainingDamage = _remainingDamage - ((random 10)/10); }; sleep 3; //systemChat(format["_remainingDamage=%1",_remainingDamage]); }; player switchMove ""; player playActionNow "stop"; } else { systemChat(format["You need a Jack Tool Kit to remove this vehicle"]); }; The script works great. Enjoy! Link to comment Share on other sites More sharing options...
Tricks Posted January 17, 2015 Report Share Posted January 17, 2015 Can't players just go around deleting other player's vehicles? Link to comment Share on other sites More sharing options...
1Man Posted January 17, 2015 Report Share Posted January 17, 2015 Yes they could even do it to ones locked if the other player went to a mission or just died, like the idea as an admin but really bad if your a dickhead player. Link to comment Share on other sites More sharing options...
DirtySanchez Posted January 18, 2015 Report Share Posted January 18, 2015 Spectacular idea but the kiddies will exploit it and cause grief in your server.... DirtySanchez 1 Link to comment Share on other sites More sharing options...
shurix Posted January 18, 2015 Author Report Share Posted January 18, 2015 Works well for a closed-community server like ours. You are free to add any checks and restrictions. Won't be as much fun though Link to comment Share on other sites More sharing options...
Gen0cide Posted January 18, 2015 Report Share Posted January 18, 2015 I'm no coding pro but when you have "custom\remove_vehicle.sqf" in your "custom\vehicle_actions.sqf" isn't that a problem when the file is saved as "custom\remove_vehicle.sql"? Link to comment Share on other sites More sharing options...
shurix Posted January 18, 2015 Author Report Share Posted January 18, 2015 I'm no coding pro but when you have "custom\remove_vehicle.sqf" in your "custom\vehicle_actions.sqf" isn't that a problem when the file is saved as "custom\remove_vehicle.sql"? I guess that's a challenge :) Link to comment Share on other sites More sharing options...
Gen0cide Posted January 18, 2015 Report Share Posted January 18, 2015 Ok after tinkering with this on my server here is how you get it running..... Follow instructions by the OP but instead of saving your "custom\remove_vehicle as a .sql save it as a .sqf. Than add these two lines to your BattlEye filters on line #25..... !="Damage >= 0.1) && (_remainingDamage < 0.2)) then {_box addMagazineCargoGlobal [_part01, 1]" !"_remainingDamage = _remainingDamag" Hope this helps ;) Link to comment Share on other sites More sharing options...
DirtySanchez Posted January 18, 2015 Report Share Posted January 18, 2015 Ok after tinkering with this on my server here is how you get it running..... Follow instructions by the OP but instead of saving your "custom\remove_vehicle as a .sql save it as a .sqf. Than add these two lines to your BattlEye filters on line #25..... !="Damage >= 0.1) && (_remainingDamage < 0.2)) then {_box addMagazineCargoGlobal [_part01, 1]" !"_remainingDamage = _remainingDamag" Hope this helps ;) Thanks Genocide for your share Gen0cide and DirtySanchez 2 Link to comment Share on other sites More sharing options...
PetuniaEpoch Posted January 18, 2015 Report Share Posted January 18, 2015 This is GREAT! However, isn't there a way to check if the vehicle is locked, and only do it for unlocked vehicles? That way, players would be able to only open 'non-owned' vehicles (well, on our server the lock time for groups is set to 6hrs, so a full reboot)? EDIT: Also, how about adding a check to see how damaged the vehicle is, so only allowing it on vehicles damaged over a certain level? That way, if the vehicle had to be: 1) Unlocked 2) Over 'x' damaged it would stop the trolling a bit. FINAL THOUGHT: Check to see if there's a jammer within 100 meters of the vehicle, exitWith { // funny message here} if it's within 100 meters of a jammer? (stops some degree of base trolling, at least! Link to comment Share on other sites More sharing options...
x_Raven_x Posted January 19, 2015 Report Share Posted January 19, 2015 Can't players just go around deleting other player's vehicles? tthats what will happen, this is a nice little hack to a persons server i wouldn't touch this with a 7 foot pole i wouldn't let someone screw with my database.. thats an admins job... Link to comment Share on other sites More sharing options...
Riddlez Posted January 27, 2015 Report Share Posted January 27, 2015 Simple solution to only allow certain people this feature. _UserList = ["1234567890","1234567890"]; if ((getPlayerUID player) in _UserList) then { [] execVM "custom\vehicle_actions.sqf"; }; Link to comment Share on other sites More sharing options...
Friendly Posted February 28, 2015 Report Share Posted February 28, 2015 I noticed if you go to central spawn you can scroll on the prop chairs and stuff and remove them infinitely for building parts. 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