Cramps2 Posted May 16, 2014 Report Share Posted May 16, 2014 Ahhhh.... Yep that is a problem Lol. OK will patch that exploit in the next release. Thanks for testing. That is quite a creative way of getting into someone's base :-). Ok, inside tow_Attachtow.sqf change this if(_IsNearVehicle > 0) then { // select the nearest one _vehicle = _findNearestVehicle select 0; _vehicleNameText = [_vehicle] call MF_Tow_Get_Vehicle_Name; _hasToolbox = "ItemToolbox" in (items player); // Check the player has a toolbox if(!_hasToolbox) exitWith { cutText ["Cannot attach tow without a toolbox.", "PLAIN DOWN"]; }; // Check if the vehicle we want to tow is locked if((_vehicle getVariable ["MF_Tow_Cannot_Tow", false])) exitWith { cutText [format["Cannot tow %1 because it is locked.", _vehicleNameText], "PLAIN DOWN"]; }; // Check that the vehicle we want to tow is not already being towed by something else. if((_vehicle getVariable ["MFTowInTow", false])) exitWith { cutText [format["Cannot tow %1 because it is already being towed by another vehicle.", _vehicleNameText], "PLAIN DOWN"]; }; // Check that the vehicle we want to tow is not already towing something else if(!MF_Tow_Multi_Towing && (_vehicle getVariable ["MFTowIsTowing", false])) exitWith { cutText [format["Cannot tow %1 because it is already towing another vehicle.", _vehicleNameText], "PLAIN DOWN"]; }; to this: if(_IsNearVehicle > 0) then { // select the nearest one _vehicle = _findNearestVehicle select 0; _vehicleNameText = [_vehicle] call MF_Tow_Get_Vehicle_Name; _hasToolbox = "ItemToolbox" in (items player); // Check the player has a toolbox if(!_hasToolbox) exitWith { cutText ["Cannot attach tow without a toolbox.", "PLAIN DOWN"]; }; // Check if the vehicle we want to tow is locked if((_vehicle getVariable ["MF_Tow_Cannot_Tow", false])) exitWith { cutText [format["Cannot tow %1 because it is locked.", _vehicleNameText], "PLAIN DOWN"]; }; // Check that the vehicle we want to tow is not already being towed by something else. if((_vehicle getVariable ["MFTowInTow", false])) exitWith { cutText [format["Cannot tow %1 because it is already being towed by another vehicle.", _vehicleNameText], "PLAIN DOWN"]; }; // Check that the vehicle we want to tow is not already towing something else if(!MF_Tow_Multi_Towing && (_vehicle getVariable ["MFTowIsTowing", false])) exitWith { cutText [format["Cannot tow %1 because it is already towing another vehicle.", _vehicleNameText], "PLAIN DOWN"]; // Check if the vehicle has anyone in it if ((count (crew _vehicle)) != 0) exitWith { cutText [format["Cannot tow %1 because it has people in it.", _vehicleNameText], "PLAIN DOWN"]; }; }; Link to comment Share on other sites More sharing options...
Cramps2 Posted May 16, 2014 Report Share Posted May 16, 2014 ok I added another check in the loop that keeps the vehicle attached just in case. I'll post the whole tow_Attachtow.sqf EDIT: Missed a }; sorry, lost in the cut/paste... /** * mf-tow/tow_AttachTow.sqf * The action for attaching the tow to another vehicle. * * Created by Matt Fairbrass (matt_d_rat) * Version: 1.1.1 * MIT Licence **/ private ["_vehicle","_started","_finished","_animState","_isMedic","_abort","_vehicleNameText","_towTruckNameText","_findNearestVehicles","_findNearestVehicle","_IsNearVehicle","_towTruck","_towableVehicles","_towableVehiclesTotal","_vehicleOffsetY","_towTruckOffsetY","_offsetZ","_hasToolbox"]; if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_96") , "PLAIN DOWN"] }; DZE_ActionInProgress = true; player removeAction s_player_towing; s_player_towing = 1; // Tow Truck _towTruck = _this select 3; _towableVehicles = [_towTruck] call MF_Tow_Towable_Array; _towableVehiclesTotal = count (_towableVehicles); _towTruckNameText = [_towTruck] call MF_Tow_Get_Vehicle_Name; // Get all nearby vehicles that can be towed by the towTruck within the minimum tow distance _findNearestVehicles = nearestObjects [_towTruck, _towableVehicles, MF_Tow_Distance]; _findNearestVehicle = []; { if (alive _x && _towTruck != _x) then { _findNearestVehicle set [(count _findNearestVehicle),_x]; }; } foreach _findNearestVehicles; _IsNearVehicle = count (_findNearestVehicle); if(_IsNearVehicle > 0) then { // select the nearest one _vehicle = _findNearestVehicle select 0; _vehicleNameText = [_vehicle] call MF_Tow_Get_Vehicle_Name; _hasToolbox = "ItemToolbox" in (items player); // Check the player has a toolbox if(!_hasToolbox) exitWith { cutText ["Cannot attach tow without a toolbox.", "PLAIN DOWN"]; }; // Check if the vehicle we want to tow is locked if((_vehicle getVariable ["MF_Tow_Cannot_Tow", false])) exitWith { cutText [format["Cannot tow %1 because it is locked.", _vehicleNameText], "PLAIN DOWN"]; }; // Check that the vehicle we want to tow is not already being towed by something else. if((_vehicle getVariable ["MFTowInTow", false])) exitWith { cutText [format["Cannot tow %1 because it is already being towed by another vehicle.", _vehicleNameText], "PLAIN DOWN"]; }; // Check that the vehicle we want to tow is not already towing something else if(!MF_Tow_Multi_Towing && (_vehicle getVariable ["MFTowIsTowing", false])) exitWith { cutText [format["Cannot tow %1 because it is already towing another vehicle.", _vehicleNameText], "PLAIN DOWN"]; }; // Check if the vehicle has anyone in it if ((count (crew _vehicle)) != 0) exitWith { cutText [format["Cannot tow %1 because it has people in it.", _vehicleNameText], "PLAIN DOWN"]; }; }; _finished = false; [_towTruck] call MF_Tow_Animate_Player_Tow_Action; r_interrupt = false; _animState = animationState player; r_doLoop = true; _started = false; while {r_doLoop} do { _animState = animationState player; _isMedic = ["medic",_animState] call fnc_inString; if (_isMedic) then { _started = true; }; if (_started and !_isMedic) then { r_doLoop = false; _finished = true; }; if ((count (crew _vehicle)) != 0) then { detach player; r_doLoop = false; }; if (r_interrupt) then { detach player; r_doLoop = false; }; sleep 0.1; }; r_doLoop = false; if(!_finished) then { r_interrupt = false; if (vehicle player == player) then { [objNull, player, rSwitchMove,""] call RE; player playActionNow "stop"; }; _abort = true; }; if (_finished) then { if(((vectorUp _vehicle) select 2) > 0.5) then { if( _towableVehiclesTotal > 0 ) then { _towTruckOffsetY = 0.8; _vehicleOffsetY = 0.8; _offsetZ = 0.1; // Calculate the offset positions depending on the kind of tow truck switch(true) do { case (_towTruck isKindOf "ArmoredSUV_Base_PMC"); case (_towTruck isKindOf "SUV_Base_EP1") : { _towTruckOffsetY = 0.9; }; case (_towTruck isKindOf "UAZ_Base" && !(_vehicle isKindOf "UAZ_Base")) : { _offsetZ = 1.8; }; }; // Calculate the offset positions depending on the kind of vehicle switch(true) do { case (_vehicle isKindOf "Truck" && !(_towTruck isKindOf "Truck")) : { _vehicleOffsetY = 0.9; }; case (_vehicle isKindOf "UAZ_Base" && !(_towTruck isKindOf "UAZ_Base")) : { _offsetZ = -1.8; }; }; // Attach the vehicle to the tow truck _vehicle attachTo [ _towTruck, [ 0, (boundingBox _towTruck select 0 select 1) * _towTruckOffsetY + (boundingBox _vehicle select 0 select 1) * _vehicleOffsetY, (boundingBox _towTruck select 0 select 2) - (boundingBox _vehicle select 0 select 2) + _offsetZ ] ]; // Detach the player from the tow truck detach player; _vehicle setVariable ["MFTowInTow", true, true]; _towTruck setVariable ["MFTowIsTowing", true, true]; _towTruck setVariable ["MFTowVehicleInTow", _vehicle, true]; cutText [format["%1 has been attached to %2.", _vehicleNameText, _towTruckNameText], "PLAIN DOWN"]; }; } else { cutText [format["Failed to attach %1 to %2.", _vehicleNameText, _towTruckNameText], "PLAIN DOWN"]; }; }; } else { cutText [format["No vehicles nearby to tow. Move within %1m of a vehicle.", MF_Tow_Distance], "PLAIN DOWN"]; }; DZE_ActionInProgress = false; s_player_towing = -1; matt_d_rat 1 Link to comment Share on other sites More sharing options...
matt_d_rat Posted May 17, 2014 Author Report Share Posted May 17, 2014 ok I added another check in the loop that keeps the vehicle attached just in case. I'll post the whole tow_Attachtow.sqf This is very good, if you want to clone the git repo and issue a pull request I would be happy to merge in your changes. If not I will add these changes for you to the next release. Edit: I have added your changes as well as some additional fixes to prevent players from entering towed vehicles. Available now in v1.1.2. Thanks for your help Cramps2. Link to comment Share on other sites More sharing options...
matt_d_rat Posted May 17, 2014 Author Report Share Posted May 17, 2014 v1.1.2 Fixed bug which allowed players to enter towed vehicles, allowing them to ghost through walls to gain access to modular bases. Added a check to interupt the attaching of the tow if a player enters the vehicle during the attachment phase. Link to comment Share on other sites More sharing options...
BetterDeadThanZed Posted May 20, 2014 Report Share Posted May 20, 2014 v1.1.2 Fixed bug which allowed players to enter towed vehicles, allowing them to ghost through walls to gain access to modular bases. Added a check to interupt the attaching of the tow if a player enters the vehicle during the attachment phase. Any progress on defining classes that can tow, rather than having to specify each vehicle that can tow? Link to comment Share on other sites More sharing options...
VentZer0 Posted May 21, 2014 Report Share Posted May 21, 2014 Any progress on defining classes that can tow, rather than having to specify each vehicle that can tow? http://pastebin.com/L2n1mi38 use this as your vehicle array ;) included all vehicles of epoch and arma, except for tanks (bmp2,bmp3,t72, ...etc LAVs/Strykers and BTRs can tow) Link to comment Share on other sites More sharing options...
VentZer0 Posted May 22, 2014 Report Share Posted May 22, 2014 does anyone got the problem that towed vehicles are still locked after they're untowed? vehicles weren't locked in the first place. Link to comment Share on other sites More sharing options...
Goatie Posted May 23, 2014 Report Share Posted May 23, 2014 does anyone got the problem that towed vehicles are still locked after they're untowed? vehicles weren't locked in the first place. Vehicles are locked when they are towed because of security so people can't enter them and get out of them inside bases. This was done in the latest release but I think it's a little buggy with some vehicles. When I tow a UAZ to a SUV it is locked, detach it and it's unlocked. When i did it with a UAZ white(the little civ car) it was still unlocked when towed. Which vehicles did the problem occur with in your case? Link to comment Share on other sites More sharing options...
VentZer0 Posted May 23, 2014 Report Share Posted May 23, 2014 its the other way around for me ... untowed vehicles stay locked and it seems to be happening with almost all of them i think Link to comment Share on other sites More sharing options...
Buly Posted May 23, 2014 Report Share Posted May 23, 2014 works great - thanks! :) Link to comment Share on other sites More sharing options...
matt_d_rat Posted May 24, 2014 Author Report Share Posted May 24, 2014 its the other way around for me ... untowed vehicles stay locked and it seems to be happening with almost all of them i think Let's be clear, are you referring to "epoch locked/unlocked" vehicles or are you referring to the changes in the last release which prevent people entering a vehicle that is in-tow? If the problem is the latter, then you can simply comment out line 150 in tow_AttachTow.sqf https://github.com/matt-d-rat/mf-tow/blob/master/tow_AttachTow.sqf#L150 and comment out line 77 in tow_DetatchTow.sqf https://github.com/matt-d-rat/mf-tow/blob/master/tow_DetachTow.sqf#L77 This would mean that people could enter vehicles which are currently in tow though. So it is entirely down to you. As you can see, at the moment I use Arma2's built in lock toggle to prevent people from entering vehicles, which can be a little buggy . It would be helpful if you could open up an issue on the GitHub issue tracker with a test case for me to reproduce. Link to comment Share on other sites More sharing options...
VentZer0 Posted May 24, 2014 Report Share Posted May 24, 2014 no, this is what happens. guy tows vehicle to another vehicle towed status locked = good guy drives around, detaches towed vehicle untowed vehicle status = STILL locked Link to comment Share on other sites More sharing options...
BetterDeadThanZed Posted May 24, 2014 Report Share Posted May 24, 2014 http://pastebin.com/L2n1mi38 use this as your vehicle array ;) included all vehicles of epoch and arma, except for tanks (bmp2,bmp3,t72, ...etc LAVs/Strykers and BTRs can tow) That looks like it's letting everything tow everything else. What I was hoping for is the ability to define what class of vehicle can tow what class of vehicle. For example, set it so a bike/motorcycle/ATV can't tow anything, set it so a car can tow a bike/motorcycle/atv and car, set it so a truck can the same as a car, plus a truck, etc.... this way I don't have to list every vehicle in the game, along with what that vehicle can tow. Link to comment Share on other sites More sharing options...
Bambit Posted May 24, 2014 Report Share Posted May 24, 2014 But 'truck' is a 'car. 'Truck' is a subcategory of a 'car', so if I let a 'car' tow a 'car' I let a skoda tow an MTVR. With the above list I cannot tow a 'truck' with a hilux. I've checked it. I cannot tow a bigger car with a smaller car and that's what I wanted to obtain, so as far as this goes, it serves it's purpose. Link to comment Share on other sites More sharing options...
tkdmaster Posted May 25, 2014 Report Share Posted May 25, 2014 Well, I applied the newest version of the mod onto my server, people are still able to chain vehicles together in giant congo-lines...... Link to comment Share on other sites More sharing options...
Bambit Posted May 25, 2014 Report Share Posted May 25, 2014 ^ right still the same problem my guess would be that something isn't right here: // Check that the vehicle we want to tow is not already being towed by something else. if((_vehicle getVariable ["MFTowInTow", false])) exitWith { cutText [format["Cannot tow %1 because it is already being towed by another vehicle.", _vehicleNameText], "PLAIN DOWN"]; }; // Check that the vehicle we want to tow is not already towing something else if(!MF_Tow_Multi_Towing && (_vehicle getVariable ["MFTowIsTowing", false])) exitWith { cutText [format["Cannot tow %1 because it is already towing another vehicle.", _vehicleNameText], "PLAIN DOWN"]; }; and here _vehicle setVariable ["MFTowInTow", true, true]; _towTruck setVariable ["MFTowIsTowing", true, true]; _towTruck setVariable ["MFTowVehicleInTow", _vehicle, true]; I think some connections between variables are missing here, but I am nowhere near of being even poor at scripting. But when I get a chance I'll try to change something here. Plus this: "MFTowVehicleInTow" doesn't correspond to anything anywhere, but maybe it shouldn't after all :D Link to comment Share on other sites More sharing options...
matt_d_rat Posted May 26, 2014 Author Report Share Posted May 26, 2014 Well, I applied the newest version of the mod onto my server, people are still able to chain vehicles together in giant congo-lines...... I'll run a full regression test today and check that the multi-tow part is still working as expected, as well as the other parts. I'll look for another way to interrupt the menu option to get into a vehicle as it seems the Arma2 locked vehicle is a little buggy. Might have something to do with the locked being local and not broadcast in multiplayer. As for the class tow class (isKindOf) feature, I am looking at a way to introduce this as a non-breaking change at the moment. More important to fix the bugs though right now. Link to comment Share on other sites More sharing options...
VentZer0 Posted May 26, 2014 Report Share Posted May 26, 2014 I'll run a full regression test today and check that the multi-tow part is still working as expected, as well as the other parts. I'll look for another way to interrupt the menu option to get into a vehicle as it seems the Arma2 locked vehicle is a little buggy. Might have something to do with the locked being local and not broadcast in multiplayer. As for the class tow class (isKindOf) feature, I am looking at a way to introduce this as a non-breaking change at the moment. More important to fix the bugs though right now. yep bugs have higher priority. people can use the lift i provided, the only downside in this method is its filesize. 120kb of text ^^ Link to comment Share on other sites More sharing options...
xdeejaycrazyx Posted May 27, 2014 Report Share Posted May 27, 2014 There is a break in your code you haven't corrected this and i dont know if anyone has noticed, if(!MF_Tow_Multi_Towing && (_vehicle getVariable ["MFTowIsTowing", false])) exitWith { cutText [format["Cannot tow %1 because it is already towing another vehicle.", _vehicleNameText], "PLAIN DOWN"]; }; this should be replaced with if((!MF_Tow_Multi_Towing) && (_vehicle getVariable ["MFTowIsTowing", false])) exitWith { cutText [format["Cannot tow %1 because it is already towing another vehicle.", _vehicleNameText], "PLAIN DOWN"]; }; Otherwise your multiple tow false option doesn't work because it doesn't get the parameters to prevent it as we had someone tow 5 vehicles until i set that command fix, Regards, xDeejayCrazyx Bambit 1 Link to comment Share on other sites More sharing options...
SASR Ryan Posted May 28, 2014 Report Share Posted May 28, 2014 Hello everyone, i am trying to implement this script, My RPT log get's no errors. But I get this error message in-game. Any help would be appreciative. Cheers, Ryan. Link to comment Share on other sites More sharing options...
Bambit Posted May 28, 2014 Report Share Posted May 28, 2014 You didn't follow the instructions... Read again step 11 And if you have that done, read steps 2 and 3 and make sure you have the "mf-tow" folder in 'addons'. Otherwise if you have a folder with 'mf-tow' addon where it's supposed to be then change it's name from 'mf-tow-master', to "mf-tow" OR change the path from step 11 to where you have the mf-tow addon. By default it's in addons\mf-tow and this message in-game tells you, that the game didn't find anything under addons\mf-tow\init.sqf path. So you either should change the path from step 11, or put the mf-tow folder the way it's done in the manual. And for god's sake, understand what you read! :D Link to comment Share on other sites More sharing options...
SASR Ryan Posted May 28, 2014 Report Share Posted May 28, 2014 hello, I have, haven't I? Link to comment Share on other sites More sharing options...
Bambit Posted May 28, 2014 Report Share Posted May 28, 2014 No, you haven't ;D If you have, it'd work. Check the paths, do you have anything in addons\mf-tow? That should be in your mission.pbo Link to comment Share on other sites More sharing options...
SASR Ryan Posted May 28, 2014 Report Share Posted May 28, 2014 it's all good i think i got it! Bambit 1 Link to comment Share on other sites More sharing options...
Bambit Posted May 28, 2014 Report Share Posted May 28, 2014 good ;) 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