Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2.  
  3. private ["_type","_index","_price","_amount","_name"];
  4. if ((lbCurSel 999) isEqualTo -1) exitWith {};
  5. _type = lbData[999,(lbCurSel 999)];
  6. _price = M_CONFIG(getNumber,"VirtualItems",_type,"sellPrice");
  7. if (_price isEqualTo -1) exitWith {};
  8.  
  9. _amount = ctrlText 1400;
  10. if (!([_amount] call TON_fnc_isnumber)) exitWith {[localize "STR_Shop_Virt_NoNum",true,"slow"] call life_fnc_notificationSystem;};
  11. _amount = parseNumber (_amount);
  12. if (_amount > (ITEM_VALUE(_type))) exitWith {[localize "STR_Shop_Virt_NotEnough",true,"slow"] call life_fnc_notificationSystem;};
  13. if ((time - life_action_delay) < 0.2) exitWith {[localize "STR_NOTF_ActionDelay",true,"slow"] call life_fnc_notificationSystem;};
  14. if (_amount < 1) exitWith {license_civ_duper = true; [2] call SOCK_fnc_updatePartial;};
  15. life_action_delay = time;
  16.  
  17. _price = (_price * _amount);
  18. _name = M_CONFIG(getText,"VirtualItems",_type,"displayName");
  19. if ([false,_type,_amount] call life_fnc_handleInv) then {
  20. [format [localize "STR_Shop_Virt_SellItem",_amount,(_name),[_price] call life_fnc_numberText],true,"slow"] call life_fnc_notificationSystem;
  21. CASH = CASH + _price;
  22.  
  23. Task_Percent pushBack _amount;
  24. [0] call SOCK_fnc_updatePartial;
  25. [] call life_fnc_market_updater;
  26. };
  27.  
  28. if (market_shop_type isEqualTo "drugdealer") then {
  29. private ["_array","_ind","_val"];
  30. _array = market_shop_npc getVariable ["sellers",[]];
  31. _ind = [getPlayerUID player,_array] call TON_fnc_index;
  32. if (!(_ind isEqualTo -1)) then {
  33. _val = ((_array select _ind) select 2);
  34. _val = _val + _price;
  35. _array set[_ind,[getPlayerUID player,profileName,_val]];
  36. market_shop_npc setVariable ["sellers",_array,true];
  37. } else {
  38. _array pushBack [getPlayerUID player,profileName,_price];
  39. market_shop_npc setVariable ["sellers",_array,true];
  40. };
  41. };
  42.  
  43. if (market_shop_type isEqualTo "gold" && (LIFE_SETTINGS(getNumber,"noatm_timer")) > 0) then {
  44. [] spawn {
  45. life_use_atm = false;
  46. sleep ((LIFE_SETTINGS(getNumber,"noatm_timer")) * 60);
  47. life_use_atm = true;
  48. };
  49. };
  50.  
  51. [3] call SOCK_fnc_updatePartial;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement