eject player from vehicle with no drivers if keys pressed: esc, tab, del, f4

This commit is contained in:
[VB]AWOL
2013-11-27 17:23:46 -06:00
parent 925453d4c4
commit e509bd5cfc
2 changed files with 24 additions and 8 deletions

View File

@@ -7,10 +7,19 @@ if (_dikCode in[0x02,0x03,0x04,0x58,0x57,0x44,0x43,0x42,0x41,0x40,0x3F,0x3E,0x3D
_handled = true;
};
if ((_dikCode == 0x3E or _dikCode == 0x0F or _dikCode == 0xD3) and (diag_tickTime - dayz_lastCheckBit > 10)) then {
if ((_dikCode == 0x3E or _dikCode == 0x0F or _dikCode == 0xD3)) then {
if(diag_tickTime - dayz_lastCheckBit > 10) then {
dayz_lastCheckBit = diag_tickTime;
call dayz_forceSave;
};
call dayz_EjectPlayer;
};
// esc
if (_dikCode == 0x01) then {
DZE_cancelBuilding = true;
call dayz_EjectPlayer;
};
// surrender
if (_dikCode in actionKeys "Surrender") then {
@@ -176,9 +185,4 @@ if (_dikCode == 0x39 or (_dikCode in actionKeys "User19")) then {
DZE_5 = true;
};
// esc
if (_dikCode == 0x01) then {
DZE_cancelBuilding = true;
};
_handled

View File

@@ -504,6 +504,18 @@ if (!isDedicated) then {
dayz_thirst = dayz_thirst + (_this select 1);
};
dayz_EjectPlayer = {
// check if player in vehicle
_vehicle = vehicle player;
_inVehicle = (_vehicle != player);
if(_inVehicle) then {
_noDriver = ((_vehicle emptyPositions "driver") > 0);
if (_noDriver) then {
player action [ "eject", (vehicle player)];
};
};
};
player_sumMedical = {
private["_character","_wounds","_legs","_arms","_medical"];
_character = _this;