Advertisement
asremix

Service Points

Aug 30th, 2014
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.02 KB | None | 0 0
  1. //Player only
  2.  
  3. BIS_fnc_numberDigits    = compile preprocessFileLineNumbers "custom\numberDigits.sqf";
  4. BIS_fnc_numberText  = compile preprocessFileLineNumbers "custom\numberText.sqf";
  5.  
  6.  
  7. // usage
  8. // _removed = [player, 5000] call SC_fnc_removeCoins;
  9. // if(_removed = true)then{  GREAT SUCCES  }else{ IT FAILED, not enoguh money};
  10.  
  11. SC_fnc_removeCoins=
  12.     {
  13.                 private ["_player","_amount","_wealth","_newwealth", "_result"];
  14.                 _player = _this select 0;
  15.                 _amount = _this select 1;
  16.                 _result = false;
  17.                 _wealth = _player getVariable["headShots",0];  
  18.                 if(_amount > 0)then{
  19.                 if (_wealth < _amount) then {
  20.                     _result = false;
  21.                 } else {                        
  22.                 _newwealth = _wealth - _amount;
  23.                 _player setVariable["headShots",_newwealth, true];
  24.                 _player setVariable ["moneychanged",1,true];    
  25.                 _result = true;
  26.                 PVDZE_plr_Save = [_player,(magazines _player),true,true] ;
  27.                 publicVariableServer "PVDZE_plr_Save";            
  28.                 };
  29.                 }else{
  30.                 _result = true;
  31.                 };
  32.                 _result
  33.     };
  34.  
  35. // usage
  36. // _added = [player, 5000] call SC_fnc_addCoins;
  37. // if(_added = true)then{ GREAT SUCCES }else{ IT FAILED, Something went wrong};
  38.    
  39. SC_fnc_addCoins =
  40. {
  41.     private ["_player","_amount","_wealth","_newwealth", "_result"];           
  42.             _player =  _this select  0;
  43.             _amount =  _this select  1;
  44.             _result = false;   
  45.             _wealth = _player getVariable["headShots",0];
  46.             _player setVariable["headShots",_wealth + _amount, true];
  47.             PVDZE_plr_Save = [_player,(magazines _player),true,true] ;
  48.             publicVariableServer "PVDZE_plr_Save";
  49.             _player setVariable ["moneychanged",1,true];                   
  50.             _newwealth = _player getVariable["headShots",0];       
  51.             if (_newwealth >= _wealth) then { _result = true; };           
  52.             _result
  53. }; 
  54.  
  55.  
  56.  
  57. if (!isDedicated) then {
  58.  
  59. .
  60. .
  61. .
  62. .
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement