Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //By Eagledude4
- _vehicle = _this select 0;
- _pos = _this select 1;
- _player = _this select 2;
- _moveDown = {
- player moveInCargo [_vehicle, _this select 0];
- ["Moving to next available cargo slot","hint",owner _player] call BIS_fnc_MP;
- [[player,"moving to next available cargo slot"],"globalChat",owner _player] call BIS_fnc_MP;
- };
- _Kickout = {
- _player action ["Eject", _vehicle];
- waitUntil{vehicle _player == _player};
- _displayName = getText(configFile >> "CfgVehicles" >> (typeOf _vehicle) >> "displayName");
- [format ["You must remove the %1's cargo before entering the cargo space.", _displayName],"hint",owner _player] call BIS_fnc_MP;
- [[player,format ["You must remove the %1's cargo before entering the cargo space.", _displayName]],"globalChat",owner _player] call BIS_fnc_MP;
- };
- waitUntil {vehicle _player == _vehicle};
- if (_pos == "cargo") then {
- //Offroad
- if (typeOf _vehicle == "C_Offroad_01_F") then {
- if ((((_vehicle getCargoIndex _player) > 0)) && ((_vehicle getVariable "box_num") < 0)) then {
- if ((_vehicle getVariable "box_num") == -2) then {
- [] spawn _Kickout;
- };
- if (((_vehicle getVariable "box_num") == -1) && (_vehicle getCargoIndex _player in [3,4])) then {
- _index = _vehicle getCargoIndex _player;
- _player action ["Eject", _vehicle];
- waitUntil{vehicle _player == _player};
- [_index - 2] spawn _moveDown;
- };
- } else {
- [getPlayerUID _player,side _player,getPosASL _player,6] call DB_fnc_updatePartial;
- };
- };
- //Zamak
- if (typeOf _vehicle in ["I_Truck_02_transport_F","I_Truck_02_covered_F"]) then {
- if ((!((_vehicle getCargoIndex _player) in [0,16])) && ((_vehicle getVariable "box_num") < 0)) then {
- if ((_vehicle getVariable "box_num") == -4) then {
- [] spawn _Kickout;
- };
- if (((_vehicle getVariable "box_num") == -1) && (_vehicle getCargoIndex _player in [2,3,4,5])) then {
- _index = _vehicle getCargoIndex _player;
- _player action ["Eject", _vehicle];
- waitUntil{vehicle _player == _player};
- switch (_index) do {
- case 2: {
- [_index + 4] spawn _moveDown;
- };
- case 3: {
- [_index + 3] spawn _moveDown;
- };
- case 4: {
- [_index + 2] spawn _moveDown;
- };
- case 5: {
- [_index + 1] spawn _moveDown;
- };
- };
- };
- if (((_vehicle getVariable "box_num") == -2) && (_vehicle getCargoIndex _player in [2,3,4,5,6,7])) then {
- _index = _vehicle getCargoIndex _player;
- _player action ["Eject", _vehicle];
- waitUntil{vehicle _player == _player};
- switch (_index) do {
- case 2: {
- [_index + 6] spawn _moveDown;
- };
- case 3: {
- [_index + 5] spawn _moveDown;
- };
- case 4: {
- [_index + 4] spawn _moveDown;
- };
- case 5: {
- [_index + 3] spawn _moveDown;
- };
- case 6: {
- [_index + 2] spawn _moveDown;
- };
- case 7: {
- [_index + 1] spawn _moveDown;
- };
- };
- };
- if (((_vehicle getVariable "box_num") == -3) && (_vehicle getCargoIndex _player in [2,3,4,5,6,7,8,9,10,11])) then {
- _index = _vehicle getCargoIndex _player;
- _player action ["Eject", _vehicle];
- waitUntil{vehicle _player == _player};
- switch (_index) do {
- case 2: {
- [_index + 10] spawn _moveDown;
- };
- case 3: {
- [_index + 9] spawn _moveDown;
- };
- case 4: {
- [_index + 8] spawn _moveDown;
- };
- case 5: {
- [_index + 7] spawn _moveDown;
- };
- case 6: {
- [_index + 6] spawn _moveDown;
- };
- case 7: {
- [_index + 5] spawn _moveDown;
- };
- case 8: {
- [_index + 4] spawn _moveDown;
- };
- case 9: {
- [_index + 3] spawn _moveDown;
- };
- case 10: {
- [_index + 2] spawn _moveDown;
- };
- case 11: {
- [_index + 1] spawn _moveDown;
- };
- };
- };
- } else {
- [getPlayerUID _player,side _player,getPosASL _player,6] call DB_fnc_updatePartial;
- };
- };
- //Tempest
- if (typeOf _vehicle in ["O_Truck_03_transport_F","O_Truck_03_covered_F"]) then {
- if ((!((_vehicle getCargoIndex _player) in [0,16])) && ((_vehicle getVariable "box_num") < 0)) then {
- if ((_vehicle getVariable "box_num") == -5) then {
- [] spawn _Kickout;
- };
- if ((((_vehicle getVariable "box_num") == -1) or ((_vehicle getVariable "box_num") == -2)) && (_vehicle getCargoIndex _player in [1,6])) then {
- _index = _vehicle getCargoIndex _player;
- _player action ["Eject", _vehicle];
- waitUntil{vehicle _player == _player};
- [_index + 1] spawn _moveDown;
- };
- if (((_vehicle getVariable "box_num") == -3) && (_vehicle getCargoIndex _player in [1,6,2,7,3,8])) then {
- _index = _vehicle getCargoIndex _player;
- _player action ["Eject", _vehicle];
- waitUntil{vehicle _player == _player};
- switch (_index) do {
- case 1: {
- [_index + 3] spawn _moveDown;
- };
- case 6: {
- [_index + 3] spawn _moveDown;
- };
- case 2: {
- [_index + 2] spawn _moveDown;
- };
- case 7: {
- [_index + 2] spawn _moveDown;
- };
- case 3: {
- [_index + 1] spawn _moveDown;
- };
- case 8: {
- [_index + 1] spawn _moveDown;
- };
- };
- };
- if (((_vehicle getVariable "box_num") == -4) && (_vehicle getCargoIndex _player in [1,6,2,7,3,8,4,9])) then {
- _index = _vehicle getCargoIndex _player;
- _player action ["Eject", _vehicle];
- waitUntil{vehicle _player == _player};
- switch (_index) do {
- case 1: {
- [_index + 4] spawn _moveDown;
- };
- case 6: {
- [_index + 4] spawn _moveDown;
- };
- case 2: {
- [_index + 3] spawn _moveDown;
- };
- case 7: {
- [_index + 3] spawn _moveDown;
- };
- case 3: {
- [_index + 2] spawn _moveDown;
- };
- case 8: {
- [_index + 2] spawn _moveDown;
- };
- case 4: {
- [_index + 1] spawn _moveDown;
- };
- case 9: {
- [_index + 1] spawn _moveDown;
- };
- };
- };
- } else {
- [getPlayerUID _player,side _player,getPosASL _player,6] call DB_fnc_updatePartial;
- };
- };
- //Hemitt
- if (typeOf _vehicle in ["B_Truck_01_covered_F","B_Truck_01_transport_F"]) then {
- if ((!((_vehicle getCargoIndex _player) in [0,17])) && ((_vehicle getVariable "box_num") < 0)) then {
- if ((_vehicle getVariable "box_num") == -5) then {
- [] spawn _Kickout;
- };
- if (((_vehicle getVariable "box_num") == -1) && (_vehicle getCargoIndex _player in [1,8])) then {
- _index = _vehicle getCargoIndex _player;
- _player action ["Eject", _vehicle];
- waitUntil{vehicle _player == _player};
- [_index + 1] spawn _moveDown;
- };
- if (((_vehicle getVariable "box_num") == -2) && (_vehicle getCargoIndex _player in [1,8,2,9])) then {
- _index = _vehicle getCargoIndex _player;
- _player action ["Eject", _vehicle];
- waitUntil{vehicle _player == _player};
- switch (_index) do {
- case 1: {
- [_index + 2] spawn _moveDown;
- };
- case 8: {
- [_index + 2] spawn _moveDown;
- };
- case 2: {
- [_index + 1] spawn _moveDown;
- };
- case 9: {
- [_index + 1] spawn _moveDown;
- };
- };
- };
- if (((_vehicle getVariable "box_num") == -3) && (_vehicle getCargoIndex _player in [1,8,2,9,3,10])) then {
- _index = _vehicle getCargoIndex _player;
- _player action ["Eject", _vehicle];
- waitUntil{vehicle _player == _player};
- switch (_index) do {
- case 1: {
- [_index + 3] spawn _moveDown;
- };
- case 8: {
- [_index + 3] spawn _moveDown;
- };
- case 2: {
- [_index + 2] spawn _moveDown;
- };
- case 9: {
- [_index + 2] spawn _moveDown;
- };
- case 3: {
- [_index + 1] spawn _moveDown;
- };
- case 10: {
- [_index + 1] spawn _moveDown;
- };
- };
- };
- if (((_vehicle getVariable "box_num") == -4) && (_vehicle getCargoIndex _player in [1,8,2,9,3,10,4,11,5,12])) then {
- _index = _vehicle getCargoIndex _player;
- _player action ["Eject", _vehicle];
- waitUntil{vehicle _player == _player};
- switch (_index) do {
- case 1: {
- [_index + 5] spawn _moveDown;
- };
- case 8: {
- [_index + 5] spawn _moveDown;
- };
- case 2: {
- [_index + 4] spawn _moveDown;
- };
- case 9: {
- [_index + 4] spawn _moveDown;
- };
- case 3: {
- [_index + 3] spawn _moveDown;
- };
- case 10: {
- [_index + 3] spawn _moveDown;
- };
- case 4: {
- [_index + 2] spawn _moveDown;
- };
- case 11: {
- [_index + 2] spawn _moveDown;
- };
- case 5: {
- [_index + 1] spawn _moveDown;
- };
- case 12: {
- [_index + 1] spawn _moveDown;
- };
- };
- };
- } else {
- [getPlayerUID _player,side _player,getPosASL _player,6] call DB_fnc_updatePartial;
- };
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement