Advertisement
Guest User

Untitled

a guest
Mar 18th, 2013
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. private["_activatingPlayer","_trader_id","_category","_action","_id","_type","_loc","_name","_qty","_cost","_qty","_sell","_cur","_order","_tid","_currency","_actionFile","_in","_out","_part","_cat","_cancel","_Display","_File","_textCurrency","_textPart"];
  2.  
  3. // [ _trader_id, _category, _action ];
  4. _activatingPlayer = _this select 1;
  5.  
  6. _vehicle = _this select 3;
  7.  
  8. {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
  9. // dayz_myCursorTarget = _vehicle;
  10.  
  11. _allFixed = true;
  12. _hitpoints = _vehicle call vehicle_getHitpoints;
  13.  
  14. {
  15. _damage = [_vehicle,_x] call object_getHit;
  16. _part = "PartGeneric";
  17.  
  18. //change "HitPart" to " - Part" rather than complicated string replace
  19. _cmpt = toArray (_x);
  20. _cmpt set [0,20];
  21. _cmpt set [1,toArray ("-") select 0];
  22. _cmpt set [2,20];
  23. _cmpt = toString _cmpt;
  24.  
  25. if(["Engine",_x,false] call fnc_inString) then {
  26. _part = "PartEngine";
  27. };
  28.  
  29. if(["HRotor",_x,false] call fnc_inString) then {
  30. _part = "PartVRotor"; //yes you need PartVRotor to fix HRotor LOL
  31. };
  32.  
  33. if(["Fuel",_x,false] call fnc_inString) then {
  34. _part = "PartFueltank";
  35. };
  36.  
  37. if(["Wheel",_x,false] call fnc_inString) then {
  38. _part = "PartWheel";
  39. };
  40.  
  41. if(["Glass",_x,false] call fnc_inString) then {
  42. _part = "PartGlass";
  43. };
  44.  
  45. // allow removal of any lightly damaged parts
  46. if (_damage < 1) then {
  47.  
  48. // Do not allow removal of engine or fueltanks
  49. if( _part == "PartGlass" or _part == "PartWheel" ) then {
  50.  
  51. _color = "color='#ffff00'"; //yellow
  52. if (_damage >= 0.5) then {_color = "color='#ff8800'";}; //orange
  53. if (_damage >= 0.9) then {_color = "color='#ff0000'";}; //red
  54.  
  55. _percent = round(_damage*100);
  56. _string = format["<t %2>Remove%1 (%3 %4)</t>",_cmpt,_color,_percent,"%"]; //Remove - Part
  57. _handle = dayz_myCursorTarget addAction [_string, "salvage\salvage.sqf",[_vehicle,_part,_x], 0, false, true, "",""];
  58. s_player_repairActions set [count s_player_repairActions,_handle];
  59. };
  60. };
  61.  
  62. } forEach _hitpoints;
  63.  
  64. if(count _hitpoints > 0 ) then {
  65.  
  66. _cancel = dayz_myCursorTarget addAction ["Cancel", "salvage\repair_cancel.sqf","repair", 0, true, false, "",""];
  67. s_player_repairActions set [count s_player_repairActions,_cancel];
  68. s_player_repair_crtl = 1;
  69. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement