daily pastebin goal
56%
SHARE
TWEET

Untitled

a guest Jun 14th, 2018 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "..\..\script_macros.hpp"
  2. /*
  3.     File: fn_virt_sell.sqf
  4.     Author: Bryan "Tonic" Boardwine
  5.  
  6.     Description:
  7.     Sell a virtual item to the store / shop
  8. */
  9. private ["_type","_index","_price","_amount","_name"];
  10. if ((lbCurSel 2402) isEqualTo -1) exitWith {};
  11. _type = lbData[2402,(lbCurSel 2402)];
  12. _price = M_CONFIG(getNumber,"VirtualItems",_type,"sellPrice");
  13. if (_price isEqualTo -1) exitWith {};
  14.  
  15. _amount = ctrlText 2405;
  16. if (!([_amount] call TON_fnc_isnumber)) exitWith {hint localize "STR_Shop_Virt_NoNum";};
  17. _amount = parseNumber (_amount);
  18. if (_amount > (ITEM_VALUE(_type))) exitWith {hint localize "STR_Shop_Virt_NotEnough"};
  19. if ((time - life_action_delay) < 0.2) exitWith {hint localize "STR_NOTF_ActionDelay";};
  20. life_action_delay = time;
  21.  
  22. //CONDTITION A AJOUTER ICI!
  23. _coef=1;
  24. if (player distance PNJ<5)then{_coef=1.15};
  25.  
  26. _price = (_price * _amount)*_coef;
  27. _name = M_CONFIG(getText,"VirtualItems",_type,"displayName");
  28. if ([false,_type,_amount] call life_fnc_handleInv) then {
  29.     hint format [localize "STR_Shop_Virt_SellItem",_amount,(localize _name),[_price] call life_fnc_numberText];
  30.     CASH = CASH + _price;
  31.     [0] call SOCK_fnc_updatePartial;
  32.     [] call life_fnc_virt_update;
  33. };
  34.  
  35. if (life_shop_type isEqualTo "drugdealer") then {
  36.     private ["_array","_ind","_val"];
  37.     _array = life_shop_npc getVariable ["sellers",[]];
  38.     _ind = [getPlayerUID player,_array] call TON_fnc_index;
  39.     if (!(_ind isEqualTo -1)) then {
  40.         _val = ((_array select _ind) select 2);
  41.         _val = _val + _price;
  42.         _array set[_ind,[getPlayerUID player,profileName,_val]];
  43.         life_shop_npc setVariable ["sellers",_array,true];
  44.     } else {
  45.         _array pushBack [getPlayerUID player,profileName,_price];
  46.         life_shop_npc setVariable ["sellers",_array,true];
  47.     };
  48. };
  49.  
  50. if (life_shop_type isEqualTo "gold" && (LIFE_SETTINGS(getNumber,"noatm_timer")) > 0) then {
  51.     [] spawn {
  52.         life_use_atm = false;
  53.         sleep ((LIFE_SETTINGS(getNumber,"noatm_timer")) * 60);
  54.         life_use_atm = true;
  55.     };
  56. };
  57.  
  58. [3] call SOCK_fnc_updatePartial;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top