Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 8.93 KB | None | 0 0
  1. #include "ZSCconfig.sqf"
  2.  
  3. call compile preprocessFileLineNumbers "ZSC\gold\player_traderMenu.sqf";
  4.  
  5. BIS_fnc_numberDigits = compile preprocessFileLineNumbers "ZSC\compiles\numberDigits.sqf";
  6. BIS_fnc_numberText = compile preprocessFileLineNumbers "ZSC\compiles\numberText.sqf";
  7. SC_fnc_removeCoins = compile preprocessFileLineNumbers "ZSC\compiles\SC_fnc_removeCoins.sqf";
  8. SC_fnc_addCoins = compile preprocessFileLineNumbers "ZSC\compiles\SC_fnc_addCoins.sqf";
  9.  
  10. /*overwrites*/
  11. if( isNil "ZSC_Overwrite_SelfActions" || ZSC_Overwrite_SelfActions)then{
  12. fnc_usec_selfActions = compile preprocessFileLineNumbers "ZSC\compiles\fn_selfActions.sqf";
  13. };
  14. if( isNil "ZSC_Overwrite_SwitchModel" || ZSC_Overwrite_SwitchModel)then{
  15. player_switchModel = compile preprocessFileLineNumbers "ZSC\compiles\player_switchModel.sqf";
  16. };
  17.  
  18.  
  19. if( isNil "ZSC_Overwrite_LockVault" || ZSC_Overwrite_LockVault)then{
  20. player_lockVault =          compile preprocessFileLineNumbers "ZSC\compiles\player_lockVault.sqf";
  21. };
  22.  
  23. if( isNil "ZSC_Overwrite_UnLockVault" || ZSC_Overwrite_UnLockVault)then{
  24. player_unlockVault =            compile preprocessFileLineNumbers "ZSC\compiles\player_unlockVault.sqf";
  25. };
  26.    
  27.  
  28. player_gearSet  =   compile preprocessFileLineNumbers "ZSC\compiles\player_gearSet.sqf";
  29. //This overwrite must happen, or change the files in your version of it. I Don't know any mod that changes this file tbh.
  30.  
  31.  
  32. /*end overwrites*/
  33.  
  34. BankDialogTransferAmount = 13000;
  35. BankDialogPlayerBalance = 13001;
  36. BankDialogBankBalance = 13002;
  37. SCTraderDialogCatList = 32000;
  38. SCTraderDialogItemList = 32001;
  39. SCTraderDialogBuyPrice = 32002;
  40. SCTraderDialogSellPrice = 32003;
  41. GivePlayerDialogTransferAmount = 14000;
  42. GivePlayerDialogPlayerBalance = 14001;
  43.  
  44. BankDialogUpdateAmounts = {
  45.     _vehicleType = typeOf ZSC_CurrentStorage;
  46.     if(isClass(configFile >> "CfgVehicles" >> _vehicleType ))then{                                 
  47.         _vehicleMagazines = getNumber (configFile >> "CfgVehicles" >> _vehicleType >> "transportMaxMagazines");
  48.         _displayName = getText  (configFile >> "CfgVehicles" >> _vehicleType >> "displayName");    
  49.         _sizeOfMoneyN = _vehicleMagazines * ZSC_MaxMoneyInStorageMultiplier;
  50.         _sizeOfMoney = [_sizeOfMoneyN] call BIS_fnc_numberText;    
  51.         ctrlSetText [2701, format["%1", _displayName]];
  52.         ctrlSetText [BankDialogPlayerBalance, format["%1 %2", (player getVariable ['cashMoney', 0] call BIS_fnc_numberText), CurrencyName]];
  53.         ctrlSetText [BankDialogBankBalance, format["%1 / %3 %2", (ZSC_CurrentStorage getVariable ['bankMoney', 0] call BIS_fnc_numberText), CurrencyName, _sizeOfMoney]];
  54.     }else{
  55.         ctrlSetText [BankDialogPlayerBalance, format["Can not get vehicle capacity!","test"]];
  56.         ctrlSetText [BankDialogBankBalance, format["Can not get vehicle capacity!","test"]];
  57.     };
  58.    
  59. };
  60.  
  61. GivePlayerDialogAmounts = {
  62.     ctrlSetText [GivePlayerDialogPlayerBalance, format["%1 %2", (player getVariable ['cashMoney', 0] call BIS_fnc_numberText), CurrencyName]];
  63.     ctrlSetText [14003, format["%1", (name ZSC_GiveMoneyTarget)]];
  64. };
  65.  
  66. BankDialogWithdrawAmount = {
  67.     private ["_amount","_bank","_wealth","_isVehicle","_countPlayers","_mansNear"];
  68.    
  69.     _amount = parseNumber (_this select 0);
  70.     _bank = ZSC_CurrentStorage getVariable ["bankMoney", 0];
  71.     _wealth = player getVariable["cashMoney",0];
  72.     _vehicleType = typeOf ZSC_CurrentStorage;
  73.     _displayName = getText  (configFile >> "CfgVehicles" >> _vehicleType >> "displayName");
  74.    
  75.     if (((player distance ZSC_CurrentStorage) > 5) or (cursorTarget != ZSC_CurrentStorage)) exitWith {
  76.         cutText ["Объект должен быть перед вами.", "PLAIN DOWN"];
  77.     };
  78.    
  79.     _countPlayers = 0;
  80.     _mansNear = nearestObjects [getPos player, ["Man"], 10];
  81.     {
  82.         if (isPlayer _x) then {
  83.             _countPlayers = _countPlayers + 1;
  84.         };
  85.     } count _mansNear;
  86.  
  87.     if ((_countPlayers - 1) >= 1) exitWith {
  88.         cutText ["Вы не можете снимать деньги пока рядом есть игрок.", "PLAIN DOWN"];
  89.     };
  90.  
  91.     _isVehicle = (ZSC_CurrentStorage isKindOf "LandVehicle") or (ZSC_CurrentStorage isKindOf "Air") or (ZSC_CurrentStorage isKindOf "Ship");
  92.  
  93.     if (_isVehicle and (locked ZSC_CurrentStorage)) exitWith {
  94.         cutText ["Вы не можете снять деньги из закрытой техники.", "PLAIN DOWN"];
  95.     };
  96.    
  97.     if (!((typeOf ZSC_CurrentStorage) in ZSC_MoneyStorage) and !_isVehicle) exitWith {
  98.         cutText ["Вы не можете снять деньги из закрытого объекта.", "PLAIN DOWN"];
  99.     }; 
  100.  
  101.     if (_amount < 1 or _amount > _bank) exitWith {
  102.         cutText [format["Вы не можете снять больше чем в %1.",_displayName], "PLAIN DOWN"];
  103.     };
  104.  
  105.     player setVariable["cashMoney",(_wealth + _amount),true];
  106.     ZSC_CurrentStorage setVariable["bankMoney",(_bank - _amount),true];
  107.  
  108.     PVDZE_plr_Save = [player,(magazines player),true,true] ;
  109.     publicVariableServer "PVDZE_plr_Save";
  110.    
  111.     PVDZE_veh_Update = [ZSC_CurrentStorage,"gear"];
  112.     publicVariableServer "PVDZE_veh_Update";
  113.  
  114.     cutText [format["Вы сняли %1 %2 из %3", [_amount] call BIS_fnc_numberText, CurrencyName,_displayName], "PLAIN DOWN"];
  115. };
  116.  
  117. BankDialogDepositAmount = {
  118.     private ["_amount","_bank","_wealth","_isVehicle","_countPlayers","_mansNear"];
  119.     _vehicleType = typeOf ZSC_CurrentStorage;  
  120.     _maxCap = 0;   
  121.     _displayName = "Storage";
  122.     if(isClass(configFile >> "CfgVehicles" >> _vehicleType ))then{ 
  123.         _displayName = getText  (configFile >> "CfgVehicles" >> _vehicleType >> "displayName");    
  124.         _vehicleMagazines = getNumber (configFile >> "CfgVehicles" >> _vehicleType >> "transportMaxMagazines");    
  125.         _maxCap = _vehicleMagazines * ZSC_MaxMoneyInStorageMultiplier; 
  126.     }else{     
  127.         _displayName = "Unknown";
  128.     };
  129.  
  130.     _amount = parseNumber (_this select 0);
  131.     _bank = ZSC_CurrentStorage getVariable ["bankMoney", 0];
  132.     _wealth = player getVariable["cashMoney",0];
  133.    
  134.     if (((player distance ZSC_CurrentStorage) > 5) or (cursorTarget != ZSC_CurrentStorage)) exitWith {
  135.         cutText ["Объект должен быть перед вами.", "PLAIN DOWN"];
  136.     };
  137.    
  138.     _countPlayers = 0;
  139.     _mansNear = nearestObjects [getPos player, ["Man"], 10];
  140.     {
  141.         if (isPlayer _x) then {
  142.             _countPlayers = _countPlayers + 1;
  143.         };
  144.     } count _mansNear;
  145.  
  146.     if ((_countPlayers - 1) >= 1) exitWith {
  147.         cutText ["Вы не можете положить деньги пока рядом есть игрок.", "PLAIN DOWN"];
  148.     };
  149.    
  150.     _isVehicle = (ZSC_CurrentStorage isKindOf "LandVehicle") or (ZSC_CurrentStorage isKindOf "Air") or (ZSC_CurrentStorage isKindOf "Ship");
  151.    
  152.     if (_isVehicle and (locked ZSC_CurrentStorage)) exitWith {
  153.         cutText ["Вы не можете положить деньги в закрытую технику.", "PLAIN DOWN"];
  154.     };
  155.    
  156.     if (!((typeOf ZSC_CurrentStorage) in ZSC_MoneyStorage) and !_isVehicle) exitWith {
  157.         cutText ["Вы не можете положить деньги в закрытый объект.", "PLAIN DOWN"];
  158.     };
  159.    
  160.     if (_amount < 1 or _amount > _wealth) exitWith {
  161.         cutText ["Вы не можете положить больше чем имеете.", "PLAIN DOWN"];
  162.     };
  163.  
  164.     if( ((_bank + _amount ) >  _maxCap)) then{     
  165.             cutText [format["Вы можете положить максимум %1 %2 в %3.", [_maxCap] call BIS_fnc_numberText,CurrencyName,_displayName], "PLAIN DOWN"];
  166.     }else{ 
  167.         player setVariable["cashMoney",(_wealth - _amount),true];
  168.         ZSC_CurrentStorage setVariable["bankMoney",(_bank + _amount),true];
  169.         cutText [format["Вы положили %1 %2 в %3.", [_amount] call BIS_fnc_numberText, CurrencyName,_displayName], "PLAIN DOWN"];
  170.     };
  171.     PVDZE_plr_Save = [player,(magazines player),true,true] ;
  172.     publicVariableServer "PVDZE_plr_Save";
  173.    
  174.     PVDZE_veh_Update = [ZSC_CurrentStorage,"gear"];
  175.     publicVariableServer "PVDZE_veh_Update";
  176. };
  177.  
  178. GivePlayerAmount = {
  179.     private ["_amount","_target","_wealth","_isMan"];
  180.    
  181.     _amount = parseNumber (_this select 0);
  182.     _target = ZSC_GiveMoneyTarget;
  183.     _wealth = player getVariable["cashMoney",0];
  184.     _twealth = _target getVariable["cashMoney",0];
  185.     _isMan = _target isKindOf "Man";
  186.  
  187.     if (_amount < 1 or _amount > _wealth) exitWith {
  188.         cutText ["Вы не можете дать больше чем в данный момент имеете.", "PLAIN DOWN"];
  189.     };
  190.  
  191.     if (!(isPlayer ZSC_GiveMoneyTarget)) exitWith {
  192.         cutText ["Вы можете давать только деньги игроку", "PLAIN DOWN"];
  193.     };
  194.    
  195.     if (!_isMan) exitWith {
  196.         cutText ["Перед вами никого нет.", "PLAIN DOWN"];
  197.     };
  198.     if (_wealth == _twealth) exitWith {
  199.         cutText ["Ошибка : Оба игрока имеют одинаковую сумму. Анти-дюп.", "PLAIN DOWN"];
  200.     };
  201.  
  202.     player setVariable["cashMoney",_wealth - _amount, true];
  203.  
  204.     _target setVariable["cashMoney",_twealth + _amount, true];
  205.  
  206.     PVDZE_plr_Save = [player,(magazines player),true,true] ;
  207.     publicVariableServer "PVDZE_plr_Save";
  208.     PVDZE_plr_Save = [_target,(magazines _target),true,true] ;
  209.     publicVariableServer "PVDZE_plr_Save";
  210.  
  211.     cutText [format["Вы дали %1 %2.", _amount, CurrencyName], "PLAIN DOWN"];
  212. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement