Advertisement
Jens_Rudolph

Untitled

May 17th, 2019
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 2.66 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.  
  34. _value = round(_illegalValue);
  35.  
  36. if(_value > 0) then {
  37.     [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];
  38.     min3factorylif3_4tmb4nk = min3factorylif3_4tmb4nk + _value;
  39.     [1] call life_fnc_updatePartial;
  40.  
  41.  
  42.     private _trunk = _vehicle getVariable["Trunk",[[],0]];
  43.  
  44.     _trunk params [
  45.         ["_inv",[],[[]]],
  46.         ["_space",0,[0]]
  47.     ];
  48.  
  49.     private _removedIllegal = false;
  50.     private _illegalItemWeight = 0;
  51.  
  52.     {
  53.         _x params [
  54.             ["_item", "", [""]],
  55.             ["_conamount", 0, [0]]
  56.         ];
  57.  
  58.         if(_item in ["cocaine_processed", "cocaine_unprocessed", "heroin_processed", "heroin_unprocessed", "marijuana", "cannabis", "lsdp", "lsdu", "frosch_processed", "frosch_unprocessed", "Crystal", "turtle_raw", "turtle_soup","lockpick","blastingcharge","methylamin","crystalProcesser"]) then {
  59.             _removedIllegal = true;
  60.             (_trunk select 0) set [_forEachIndex, -1];
  61.            
  62.             _illegalItemWeight = _illegalItemWeight + (([_item] call life_fnc_itemWeight) * _conamount);
  63.         };
  64.     } forEach (_inv);
  65.      
  66.     if(_removedIllegal) then {
  67.         _trunk set [0,((_trunk select 0) - [-1])];
  68.         _trunk set [1,_space - _illegalItemWeight];
  69.     };
  70.  
  71.     ["Illegale Gegenstände gefunden.",false,"fast"] call life_fnc_NachrichtSys;
  72.  
  73.  
  74.     _vehicle SVAR["Trunk",[_inv,_space - _illegalItemWeight],true];
  75. } else {
  76.     ["Keine illegalen Gegenstände gefunden.",false,"fast"] call life_fnc_NachrichtSys;
  77. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement