-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexportweapon.sqf
34 lines (24 loc) · 1.13 KB
/
exportweapon.sqf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
if(fvspam)exitwith{};
_item = _this select 0;
_infos = _item call INV_getitemArray;
_shopnum = 0;
if (_item call INV_GetWeaponTyp == 1) then {
_shopnum = pistolshop call INV_getshopnum;
};
if (_item call INV_GetWeaponTyp == 2) then {
_shopnum = rifleshop call INV_getshopnum;
};
_stock = [_item, _shopnum] call INV_getstock;
_maxstock = [_item, _shopnum] call INV_getmaxstock;
_preisOhneTax = (_infos call INV_getitemBuyCost)*1;
_preis = (_infos call INV_getitemCostWithTax)*1;
_demand = _preis*0.5*(_stock-(_maxstock*0.5))/(0.5*_maxstock);
_preis = round((_preisOhneTax*(_preis/_preisOhneTax)) - _demand);
fvspam=true;
if(_stock >= _maxstock)exitwith{player groupchat "The shop has reached its maximum stock for this weapon.";fvspam=false;};
['cash', _preis] call INV_AddInventoreItem;
player groupchat format["The weapon has been exported for $%1!", _preis];
call compile format['if(%1avail > 0)then{%1avail = %1avail - 1;["%1avail", %1avail] call ClientSaveVar};', _item];
format['["%1", (%2 + 1), %3] call INV_itemstocksupdate;', _item, _stock, _shopnum] call broadcast;
sleep 1;
fvspam=false;