Advertisement
Guest User

Untitled

a guest
Jan 24th, 2020
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.42 KB | None | 0 0
  1. {
  2. private ["_classname","_arpname"];
  3. _classname = _this select 0;
  4. _arpname = _this select 1;
  5. _text = "";
  6. _price = "";
  7.  
  8. switch (ARP_shopcfgtype) do {
  9. case "CfgVehicles": {
  10. _text = getText (configFile >> ARP_shopcfgtype >> _classname >> 'displayName');
  11. _Vehicle = _classname createVehicle (getMarkerPos ARP_Spawnpoint);
  12. _Maxweight = 0;
  13. {
  14. if (_arpname == _x select 0) exitWith {
  15. _price = _x select 2;
  16. _Maxweight = _x select 4;
  17. };
  18. } count ARP_Vehicle_Config;
  19.  
  20. _Dir = markerDir ARP_Spawnpoint;
  21. _Vehicle setDir _dir;
  22. _Vehicle setpos (getMarkerPos ARP_Spawnpoint);
  23.  
  24. clearBackpackCargoGlobal _Vehicle;
  25. clearItemCargoGlobal _Vehicle;
  26. clearWeaponCargoGlobal _Vehicle;
  27. clearMagazineCargoGlobal _Vehicle;
  28.  
  29. _Vehicle lock true;
  30.  
  31. _ColorPrePicked = [_arpname] call ARP_SetTexture_IsInArray;
  32. _colorinPut = "";
  33. _ColorSel = lbData[2101,lbCurSel 2101];
  34.  
  35. if (_ColorSel != "") then {
  36. _Vehicle setObjectTextureGlobal[0,_ColorSel];
  37. {
  38. _txt = _x select 0;
  39. _colormatch = _x select 1;
  40. if (_colormatch == _ColorSel) exitWith {
  41. _colorinPut = _txt;
  42. };
  43. } count ARP_Vehicle_ColorSelection;
  44. };
  45.  
  46.  
  47. [format["%1 Successfully bought for $%2",_text,[ARP_Shop_Price] call ARP_Lib_FormatNumber],ARP_Green] call ARP_MessageSystem;
  48. _Vehicle setVariable ["ARP_isVehicle",true,true];
  49. _Vehicle setVariable ["ARP_AntiHack_VehAllowed",true,true];
  50. _Vehicle setVariable ["ARP_OwnerID",getPlayerUID player,true];
  51. _Vehicle setVariable ["ARP_Vehicle_BaitKit_Active",false,true];
  52. _Vehicle setVariable ["ARP_Vehicle_BaitKit_Unit",123,true];
  53. _Vehicle setVariable ["ARP_Sirens",false,true];
  54. _Vehicle setVariable ["ARP_Veh_Repoed",false,true];
  55. _Vehicle setVariable ["ARP_Repo_InProgress",false,true];
  56. _Vehicle setVariable ["ARP_Sirens_Lightbar",false,true];
  57. _Vehicle setVariable ["ARP_TrunkAccess",0,true];
  58. _Vehicle setVariable ["ARP_Transfer_ToCompany","",true];
  59. [_Vehicle] remoteExec ["ARP_Fire_WaitLoop",2];
  60. [_Maxweight,_classname,player,_Vehicle,_arpname,_colorinPut] remoteExec ["ARP_VehicleDB_Insert",2];
  61. _Vehicle setVariable ["ARPName",_arpname,true];
  62. _Vehicle setVariable ["ARP_Vehicle_Insurance",false,true];
  63. _Vehicle setVariable ["ARP_Veh_Upgrade",0,true];
  64. _Vehicle setFuelCargo 0;
  65.  
  66. [_arpname,_Vehicle,_colorinPut,_ColorPrePicked] call ARP_VehicleSpawn_Apply_Check;
  67. [_arpname,_Vehicle] call ARP_SetTexture_Set;
  68.  
  69. if (_ColorSel != "") then {
  70. [_Vehicle,_ColorSel] spawn {
  71. params["_Vehicle","_colorSet"];
  72. sleep 6;
  73. _Vehicle setObjectTextureGlobal[0,_colorSet];
  74. };
  75. };
  76. diag_log "Vehicle added to database.";
  77.  
  78. ARP_CanSave_Stats = true;
  79.  
  80. [_Vehicle] spawn {
  81. params["_Vehicle"];
  82. sleep 2;
  83. _PlateSet = toUpper(_Vehicle getVariable "ARP_VehiclePlate");
  84. _Vehicle setPlateNumber _PlateSet;
  85. };
  86. };
  87.  
  88. case "Gear": {
  89. [format["Successfully bought gear for $%1!",[ARP_Shop_Price] call ARP_Lib_FormatNumber],ARP_Green] call ARP_MessageSystem;
  90. ARP_Shop_GearBought = true;
  91. player setPosASL ARP_Shop_OldASL;
  92. ARP_CanSave_Stats = true;
  93.  
  94. if (vest player != "") then {
  95. {
  96. player addItemToVest _x;
  97. } foreach ARP_Vest_backup;
  98. };
  99. if (uniform player != "") then {
  100. {
  101. player addItemToUniform _x;
  102. } foreach ARP_Uniform_backup;
  103. };
  104. if (backpack player != "") then {
  105. clearWeaponCargoGlobal (unitBackpack player);
  106. clearItemCargoGlobal (unitBackpack player);
  107. clearMagazineCargoGlobal (unitBackpack player);
  108. clearAllItemsFromBackpack (unitBackpack player);
  109.  
  110. {
  111. player addItemToBackpack _x;
  112. } foreach ARP_Backpack_backup;
  113. };
  114. };
  115. };
  116. [] call ARP_Shop_Exit;
  117. player say3D "ARP_BuySound";
  118. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement