Skip to content

Commit 3f594d2

Browse files
committed
Merge pull request #4 from matt-d-rat/story/prevent-entering-towed-vehicles
Bug - Prevent players from entering towed vehicles.
2 parents 3d6ac42 + 3309182 commit 3f594d2

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,10 @@ __Step 18: Repack ```dayz_server.pbo``` and upload it to your server.
252252

253253
### Change Log ###
254254

255+
#### v1.1.2 ###
256+
- Fixed bug which allowed players to enter towed vehicles, allowing them to ghost through walls to gain access to modular bases.
257+
- Added a check to interupt the attaching of the tow if a player enters the vehicle during the attachment phase.
258+
255259
#### v1.1.1 ###
256260
- Fixed exploit which allowed players to tow vehicles which were already being towed.
257261
- Fixed exploit which allowed players to tow vehicles which were already towing another vehicle. This functionality can be turned back on via the ```MF_Tow_Multi_Towing``` config param being set to true (default value is false). Be warned, turning this on produces "interesting" results and probably only serves as a means for trolling.

init.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* The main script for initalising towing functionality.
44
*
55
* Created by Matt Fairbrass (matt_d_rat)
6-
* Version: 1.1.1
6+
* Version: 1.1.2
77
* MIT Licence
88
**/
99

tow_AttachTow.sqf

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* The action for attaching the tow to another vehicle.
44
*
55
* Created by Matt Fairbrass (matt_d_rat)
6-
* Version: 1.1.1
6+
* Version: 1.1.2
77
* MIT Licence
88
**/
99

@@ -58,6 +58,11 @@ if(_IsNearVehicle > 0) then {
5858
cutText [format["Cannot tow %1 because it is already towing another vehicle.", _vehicleNameText], "PLAIN DOWN"];
5959
};
6060

61+
// Check if the vehicle has anyone in it
62+
if ((count (crew _vehicle)) != 0) exitWith {
63+
cutText [format["Cannot tow %1 because it has people in it.", _vehicleNameText], "PLAIN DOWN"];
64+
};
65+
6166
_finished = false;
6267

6368
[_towTruck] call MF_Tow_Animate_Player_Tow_Action;
@@ -73,14 +78,23 @@ if(_IsNearVehicle > 0) then {
7378
if (_isMedic) then {
7479
_started = true;
7580
};
81+
7682
if (_started and !_isMedic) then {
7783
r_doLoop = false;
7884
_finished = true;
7985
};
86+
87+
// Check if anyone enters the vehicle while we are attaching the tow and stop the action
88+
if ((count (crew _vehicle)) != 0) then {
89+
cutText [format["Towing aborted because the %1 was entered by another player.", _vehicleNameText], "PLAIN DOWN"];
90+
r_interrupt = true;
91+
};
92+
8093
if (r_interrupt) then {
8194
detach player;
8295
r_doLoop = false;
8396
};
97+
8498
sleep 0.1;
8599
};
86100
r_doLoop = false;
@@ -132,8 +146,8 @@ if(_IsNearVehicle > 0) then {
132146
]
133147
];
134148

135-
// Detach the player from the tow truck
136149
detach player;
150+
_vehicle lock true; // Disable entering the vehicle while it is in tow.
137151

138152
_vehicle setVariable ["MFTowInTow", true, true];
139153
_towTruck setVariable ["MFTowIsTowing", true, true];

tow_DetachTow.sqf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* The action for detaching the tow from another vehicle.
44
*
55
* Created by Matt Fairbrass (matt_d_rat)
6-
* Version: 1.1.1
6+
* Version: 1.1.2
77
* MIT Licence
88
**/
99

@@ -72,10 +72,10 @@ if(_isTowing) then {
7272
};
7373

7474
if (_finished) then {
75-
7675
detach _vehicle;
7776
detach player;
78-
77+
_vehicle lock false; // Enable players to re-enter the vehicle now it has been detached.
78+
7979
_vehicle setVariable ["MFTowInTow", false, true];
8080
_towTruck setVariable ["MFTowIsTowing", false, true];
8181
_towTruck setVariable ["MFTowVehicleInTow", objNull, true];

0 commit comments

Comments
 (0)