Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "..\..\script_macros.hpp"
- /*
- File: fn_vehInvSearch.sqf
- Author: Bryan "Tonic" Boardwine
- Description:
- Searches the vehicle for illegal items.
- */
- private["_vehicle","_vehicleInfo","_value","_list","_weight","_sum","_itemWeight"];
- _vehicle = cursorObject;
- _list = ["Air","Ship","LandVehicle"];
- if(isNull _vehicle OR {!(KINDOF_ARRAY(_vehicle,_list))}) exitWith {};
- _vehicleInfo = _vehicle GVAR ["Trunk",[]];
- if(EQUAL(count _vehicleInfo,0)) exitWith {["Dieses Fahrzeug ist leer!",true,"fast"] call life_fnc_NachrichtSys;};
- _value = 0;
- _illegalValue = 0;
- {
- _var = SEL(_x,0);
- _val = SEL(_x,1);
- _isIllegalItem = M_CONFIG(getNumber,"VirtualItems",_var,"illegal");
- if(_isIllegalItem == 1 ) then {
- _illegalPrice = M_CONFIG(getNumber,"VirtualItems",_var,"sellPrice");
- if(!isNull (missionConfigFile >> "VirtualItems" >> _var >> "processedItem")) then {
- _illegalItemProcessed = M_CONFIG(getText,"VirtualItems",_var,"processedItem");
- _illegalPrice = M_CONFIG(getNumber,"VirtualItems",_illegalItemProcessed,"sellPrice");
- };
- _illegalValue = _illegalValue + (round(_val * _illegalPrice / 2));
- };
- } foreach (SEL(_vehicleInfo,0));
- _value = round(_illegalValue);
- if(_value > 0) then {
- [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];
- min3factorylif3_4tmb4nk = min3factorylif3_4tmb4nk + _value;
- [1] call life_fnc_updatePartial;
- private _trunk = _vehicle getVariable["Trunk",[[],0]];
- _trunk params [
- ["_inv",[],[[]]],
- ["_space",0,[0]]
- ];
- private _removedIllegal = false;
- private _illegalItemWeight = 0;
- {
- _x params [
- ["_item", "", [""]],
- ["_conamount", 0, [0]]
- ];
- 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 {
- _removedIllegal = true;
- (_trunk select 0) set [_forEachIndex, -1];
- _illegalItemWeight = _illegalItemWeight + (([_item] call life_fnc_itemWeight) * _conamount);
- };
- } forEach (_inv);
- if(_removedIllegal) then {
- _trunk set [0,((_trunk select 0) - [-1])];
- _trunk set [1,_space - _illegalItemWeight];
- };
- ["Illegale Gegenstände gefunden.",false,"fast"] call life_fnc_NachrichtSys;
- _vehicle SVAR["Trunk",[_inv,_space - _illegalItemWeight],true];
- } else {
- ["Keine illegalen Gegenstände gefunden.",false,"fast"] call life_fnc_NachrichtSys;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement