Advertisement
GaspArt

Pay for healing v2.0

Dec 4th, 2015
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 7.23 KB | None | 0 0
  1. // Pay for healing v.2
  2. // Author: GaspArt aka SixPeso
  3. // Special thanks to Axeman for correction of errors.
  4. private ["_needAntibiotics","_needBandage","_needPainkiller","_needBloodbag","_needMorphine","_costEtc","_costBandage","_costAntibiotics","_costPainkiller","_costBloodbag","_costMorphine","_array","_unit","_medic","_costInstantHeal","_notEnough","_cashmoney"];
  5. disableserialization;
  6. _array = _this;
  7. _unit = _array select 0;
  8. _medic = _array select 1;
  9. _needAntibiotics = 0;
  10. _needBandage = 0;
  11. _needBloodbag = 0;
  12. _needMorphine = 0;
  13. _needPainkiller = 0;
  14.  
  15.  //////////////////
  16.  /*Configs Start */
  17.  //////////////////
  18.  
  19. _instantHeal = false; // If you want to heal player in one action set True, if you want to heal only player's damaged parts of body set False.
  20. _costInstantHeal = 1000; //Works only if instantHeal = true
  21.  
  22.  
  23. //Configs if _instantHeal = False;
  24. //Price list:
  25. _costAntibiotics = 111;
  26. _costBandage = 222;
  27. _costPainkiller = 333;
  28. _costBloodbag = 444;
  29. _costMorphine = 555;
  30. _costEtc = 666; //paying for food,drink, disabling camerashake, heatpack and another not valuable parameters.
  31.  
  32.  
  33. //////////////////
  34. /*  Configs End */
  35. //////////////////
  36.  
  37.  
  38. if (_unit == player) then {
  39. //unit = player
  40. _cashMoney = player getVariable["cashMoney",0];     //getting cash
  41.     if (_instantHeal) then {                    //instantHeal = true
  42.         if (_cashmoney < _costInstantHeal) then {
  43.             _notEnough = _costInstantHeal - _cashMoney;
  44.             [format["<t size='1.2' color='#D01000'>Dear %1</t><br/><t size='0.9'>you need %2 coins more to pay for treatment.</t>",(name player),(_notEnough)],0,0,2,2] spawn BIS_fnc_dynamicText;         
  45.         } else {
  46.     //Paying for instant healing
  47.             _cashMoney = _cashMoney - _costInstantHeal;
  48.             player setVariable ["cashMoney", _cashMoney , true];
  49.             [format["<t size='1.2' color='#018E0B'>Dear %1</t><br/><t size='0.9'>you were completely cured. You spent 2% coins.</t>",(name player),(_costInstantHeal)],0,0,2,2] spawn BIS_fnc_dynamicText;
  50.     //Instant healing start    
  51.                 disableSerialization;
  52.                 dayz_sourceBleeding = objNull;
  53.                 r_player_blood = r_player_bloodTotal;
  54.                 r_player_inpain = false;
  55.                 r_player_infected = false;
  56.                 r_player_injured = false;
  57.                 dayz_hunger = 0;
  58.                 dayz_thirst = 0;
  59.                 dayz_temperatur = 37;
  60.                 r_fracture_legs = false;
  61.                 r_fracture_arms = false;
  62.                 r_player_dead = false;
  63.                 r_player_unconscious = false;
  64.                 r_player_loaded = false;
  65.                 r_player_cardiac = false;
  66.                 r_player_lowblood = false;
  67.                 r_player_timeout = 0;
  68.                 r_handlercount = 0;
  69.                 r_interrupt = false;
  70.                 r_doLoop = false;
  71.                 r_drag_sqf = false;
  72.                 r_self = false;
  73.                 r_action = false;
  74.                 r_action_unload = false;
  75.                 r_player_handler = false;
  76.                 r_player_handler1 = false;
  77.                 disableUserInput false;
  78.                 'dynamicBlur' ppEffectAdjust [0];
  79.                 'dynamicBlur' ppEffectCommit 5;
  80.                 _selection = 'legs';
  81.                 _damage = 0;
  82.                 player setHit[_selection,_damage];
  83.                 player setVariable['messing',[dayz_hunger,dayz_thirst],true];
  84.                 player setVariable['NORRN_unconscious',false,true];
  85.                 player setVariable['USEC_infected',false,true];
  86.                 player setVariable['USEC_injured',false,true];
  87.                 player setVariable['USEC_inPain',false,true];
  88.                 player setVariable['USEC_isCardiac',false,true];
  89.                 player setVariable['USEC_lowBlood',false,true];
  90.                 player setVariable['USEC_BloodQty',12000,true];
  91.                 player setVariable['unconsciousTime',0,true];
  92.                 player setVariable['hit_legs',0,true];
  93.                 player setVariable['hit_hands',0,true];
  94.                 player setVariable['medForceUpdate',true,true];
  95.                 _display = uiNameSpace getVariable 'DAYZ_GUI_display';
  96.                 _control = _display displayCtrl 1303;
  97.                 _control ctrlShow false;
  98.                 _display = uiNameSpace getVariable 'DAYZ_GUI_display';
  99.                 _control = _display displayCtrl 1203;
  100.                 _control ctrlShow false;
  101.                 player setdamage 0;
  102.                 0 fadeSound 1;
  103.                 resetCamShake;
  104. // Instant healing end         
  105.         };     
  106.     } else {                                        //instantHeal = false
  107.         if (r_player_injured) then {_costEtc = _costEtc + _costBandage; _needBandage = 1;}; //check for bleeding
  108.         if (r_player_blood < 12000) then {_costEtc = _costEtc + _costBloodbag; _needBloodbag = 1;}; //check for less blood
  109.         if (r_fracture_legs) then {_costEtc = _costEtc + _costMorphine; _needMorphine = 1;};    //check for broken legs
  110.         if (r_player_inpain) then {_costEtc = _costEtc + _costPainkiller; _needPainkiller = 1;};    //check for pain
  111.         if (r_player_infected) then {_costEtc = _costEtc + _costAntibiotics;_needAntibiotics =1;};  //check for infection
  112.        
  113.         if (_cashmoney < _costEtc) then {
  114.             _notEnough = _costEtc - _cashMoney;
  115.             [format["<t size='1.2' color='#D01000'>Dear %1</t><br/><t size='0.9'>you need %2 coins more to pay for treatment.</t>",(name player),(_notEnough)],0,0,2,2] spawn BIS_fnc_dynamicText;         
  116.         } else {
  117.     //Paying for healing
  118.             _cashMoney = _cashMoney - _costEtc;
  119.             player setVariable ["cashMoney", _cashMoney , true];
  120.             [format["<t size='1.2' color='#018E0B'>Dear %1</t><br/><t size='0.9'>you were completely cured. You spent %2 coins.</t>",(name player),(_costEtc)],0,0,2,2] spawn BIS_fnc_dynamicText;     
  121.  
  122.             if (_needBloodbag == 1) then {
  123.                 r_player_blood = r_player_bloodTotal;
  124.                 player setdamage 0;};  
  125.             if (_needPainkiller == 1) then {   
  126.                 r_player_inpain = false;
  127.                 player setVariable['USEC_inPain',false,true];};
  128.             if (_needAntibiotics == 1) then {
  129.                 r_player_infected = false;
  130.                 player setVariable['USEC_infected',false,true];};
  131.             if (_needBandage == 1) then {              
  132.                 r_player_injured = false;          
  133.                 player setVariable['USEC_injured',false,true];
  134.                 dayz_sourceBleeding = objNull;};
  135.  
  136.             if (_needMorphine == 1) then {
  137.                 r_fracture_legs = false;
  138.                 r_fracture_arms = false;
  139.                 _selection = 'legs';
  140.                 _damage = 0;
  141.                 player setHit[_selection,_damage];
  142.                 player setVariable['hit_legs',0,true];
  143.                 player setVariable['hit_hands',0,true];};      
  144.  
  145.                 disableSerialization;
  146.                 dayz_hunger = 0;
  147.                 dayz_thirst = 0;
  148.                 dayz_temperatur = 37;
  149.                 r_player_dead = false;
  150.                 r_player_unconscious = false;
  151.                 r_player_loaded = false;
  152.                 r_player_cardiac = false;
  153.                 r_player_lowblood = false;
  154.                 r_player_timeout = 0;
  155.                 r_handlercount = 0;
  156.                 r_interrupt = false;
  157.                 r_doLoop = false;
  158.                 r_drag_sqf = false;
  159.                 r_self = false;
  160.                 r_action = false;
  161.                 r_action_unload = false;
  162.                 r_player_handler = false;
  163.                 r_player_handler1 = false;
  164.                 disableUserInput false;
  165.                 'dynamicBlur' ppEffectAdjust [0];
  166.                 'dynamicBlur' ppEffectCommit 5;
  167.                 player setVariable['messing',[dayz_hunger,dayz_thirst],true];
  168.                 player setVariable['NORRN_unconscious',false,true];
  169.                 player setVariable['USEC_isCardiac',false,true];
  170.                 player setVariable['USEC_lowBlood',false,true];
  171.                 player setVariable['USEC_BloodQty',12000,true];
  172.                 player setVariable['unconsciousTime',0,true];
  173.                 player setVariable['medForceUpdate',true,true];
  174.                 _display = uiNameSpace getVariable 'DAYZ_GUI_display';
  175.                 _control = _display displayCtrl 1303;
  176.                 _control ctrlShow false;
  177.                 _display = uiNameSpace getVariable 'DAYZ_GUI_display';
  178.                 _control = _display displayCtrl 1203;
  179.                 _control ctrlShow false;
  180.                 0 fadeSound 1;
  181.                 resetCamShake;
  182.     };
  183.     };
  184.    
  185. } else {
  186. //unit != player
  187. ["<t size='1.0' color='#C38101'>You are not a player! O_o </t>",0,0,2,2] spawn bis_fnc_dynamicText;
  188. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement