Advertisement
Jens_Rudolph

Untitled

May 10th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 2.97 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2. /*
  3.     File: fn_vehInvSearch.sqf
  4.     Author: Bryan "Tonic" Boardwine
  5.  
  6.     Description:
  7.     Searches the vehicle for illegal items.
  8. */
  9. private["_vehicle","_vehicleInfo","_value","_list","_weight","_sum","_itemWeight"];
  10. _vehicle = cursorObject;
  11. _list = ["Air","Ship","LandVehicle"];
  12.  
  13. if(isNull _vehicle OR {!(KINDOF_ARRAY(_vehicle,_list))}) exitWith {};
  14.  
  15. _vehicleInfo = _vehicle GVAR ["Trunk",[]];
  16. if(EQUAL(count _vehicleInfo,0)) exitWith {["Dieses Fahrzeug ist leer!",true,"fast"] call life_fnc_NachrichtSys;};
  17.  
  18. _value = 0;
  19. _illegalValue = 0;
  20. {
  21.     _var = SEL(_x,0);
  22.     _val = SEL(_x,1);
  23.     _isIllegalItem = M_CONFIG(getNumber,"VirtualItems",_var,"illegal");
  24.     if(_isIllegalItem == 1 ) then {
  25.         _illegalPrice = M_CONFIG(getNumber,"VirtualItems",_var,"sellPrice");
  26.         if(!isNull (missionConfigFile >> "VirtualItems" >> _var >> "processedItem")) then {
  27.             _illegalItemProcessed = M_CONFIG(getText,"VirtualItems",_var,"processedItem");
  28.             _illegalPrice = M_CONFIG(getNumber,"VirtualItems",_illegalItemProcessed,"sellPrice");
  29.         };
  30.         _illegalValue = _illegalValue + (round(_val * _illegalPrice / 2));
  31.     };
  32. } foreach (SEL(_vehicleInfo,0));
  33. _value = round(_illegalValue);
  34. if(_value > 0) then {
  35.     [0, format["Ein Fahrzeug wurde durchsucht und es wurden Drogen / Schmuggelware im Wert von $%1 gefunden. Die illegalen Gegenstände wurden beschlagnahmt!", _value]] remoteExec ["life_fnc_broadcast", -2];
  36.     min3factorylif3_4tmb4nk = min3factorylif3_4tmb4nk + _value;
  37.     [1] call SOCK_fnc_updatePartial;
  38.  
  39.  
  40.     private _trunk = _vehicle getVariable["Trunk",[]];
  41.  
  42.     _ndtrunk = _vehicle getVariable["Trunk",[[],0]];
  43.     _ndtrunk params [
  44.         ["_inv",[],[[]]],
  45.         ["_space",0,[0]]
  46.     ];
  47.  
  48.     private _removedIllegal = false;
  49.  
  50.     {
  51.         _x params [
  52.             ["_item", "", [""]],
  53.             ["_conamount", 0, [0]]
  54.         ];
  55.  
  56.         if(_item in ["cocaine_processed", "cocaine_unprocessed", "heroin_processed", "heroin_unprocessed", "marijuana", "cannabis", "lsdp", "lsdu", "frosch_processed", "frosch_unprocessed", "Crystal", "turtle_raw", "turtle_soup"]) then {
  57.             _removedIllegal = true;
  58.             (_trunk select 0) set [_forEachIndex, -1];
  59.             _amount = _amount + _conamount;
  60.         };
  61.     } forEach (_inv);
  62.      
  63.     if(_removedIllegal) then {
  64.         _trunk set [0,((_trunk select 0) - [-1])];
  65.         _trunk set [1,[_trunk select 0] call life_fnc_RESERVEcalculateWeight];
  66.     };
  67.  
  68.     ["Illegale Gegenstände gefunden.",false,"fast"] call life_fnc_NachrichtSys;
  69.  
  70.     _illegalweight = [_vehicle] call life_fnc_vehicleWeight;
  71.     _illegalsum = [_item,_amount,_illegalweight select 1,_illegalweight select 0] call life_fnc_calWeightDiff; // Get a sum base of the remaining weight..
  72.     _illegalItemWeight = ([_item] call life_fnc_itemWeight) * _illegalsum;
  73.  
  74.     _vehicle SVAR["Trunk",[_inv,_space - _illegalItemWeight],true];
  75.  
  76. /*
  77.     _amount = [_vehicle] call life_fnc_calculateWeight;
  78.     _vehicle SVAR["Trunk",[_inv,_amount],true];
  79. */
  80. } else {
  81.     ["Keine illegalen Gegenstände gefunden.",false,"fast"] call life_fnc_NachrichtSys;
  82. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement