ghost_dz4

removeclothes.sqf

Jun 29th, 2016
89
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Zupa */
  2. player removeAction s_clothes;
  3. s_clothes = -1;
  4.  
  5. _body = _this select 3;
  6. _model = typeOf _body;
  7.  
  8. if( _model in Clothing1)then{_model = "FR_OHara_DZ"; //OK
  9. }else{
  10. if( _model in Clothing2)then{_model = "Soldier1_DZ";//OK
  11. }else{
  12. if( _model in Clothing3)then{_model = "Ins_Soldier_GL_DZ";//OK
  13. }else{
  14. if( _model in Clothing4)then{_model = "GUE_Soldier_Crew_DZ";//OK
  15. }else{
  16. if( _model in Clothing5)then{_model = "Graves_Light_DZ";//OK
  17. }else{
  18. if( _model in Clothing6)then{_model = "CZ_Special_Forces_GL_DES_EP1_DZ";//OK
  19. }else{
  20. if( _model in Clothing7)then{_model = "Bandit2_DZ";//OK
  21. }else{
  22. if( _model in Clothing8)then{_model = "Soldier_Bodyguard_AA12_PMC_DZ";//OK
  23. }else{
  24. if( _model in Clothing9)then{_model = "TK_INS_Soldier_EP1_DZ";//OK
  25. }else{
  26. if( _model in Clothing10)then{_model = "Survivor2_DZ";//OK
  27. }else{
  28. if( _model in Clothing11)then{_model = "FR_Rodriguez_DZ";//OK - Edit this one for normal arma. The rest coming is overwatch.
  29. }else{////2
  30. if( _model in Clothing12)then{_model = "Drake_Light_DZ";//OK
  31. }else{////3
  32. if( _model in Clothing13)then{_model = "Soldier_Sniper_PMC_DZ";//OK
  33. }else{////4
  34. if( _model in Clothing14)then{_model = "CZ_Soldier_Sniper_EP1_DZ";//OK
  35. }else{////5
  36. if( _model in Clothing15)then{_model = "Camo1_DZ";//OK
  37. }else{////6
  38. if( _model in Clothing16)then{_model = "Rocket_DZ";//OK
  39. }else{////7
  40. if( _model in Clothing17)then{_model = "Sniper1_DZ";//OK
  41. }else{////8
  42. if( _model in Clothing18)then{_model = "Soldier_TL_PMC_DZ";//OK
  43. }else{////9
  44. if( _model in Clothing19)then{_model = "GUE_Soldier_Sniper_DZ";//OK
  45. }else{////10
  46. if( _model in Clothing20)then{_model = "TK_INS_Warlord_EP1_DZ";//OK
  47. }else{////11
  48. if( _model in Clothing21)then{_model = "Bandit1_DZ";
  49. }else{////12
  50. if( _model in Clothing22)then{_model = "Bandit2_DZ";
  51. }else{////13
  52. if( _model in Clothing23)then{_model = "BanditW1_DZ";
  53. }else{////14
  54. if( _model in Clothing24)then{_model = "BanditW2_DZ";
  55. }else{////15
  56. if( _model in Clothing25)then{_model = "GUE_Commander_DZ";
  57. }else{////16
  58. if( _model in Clothing26)then{_model = "GUE_Soldier_2_DZ";
  59. }else{////17
  60. if( _model in Clothing27)then{_model = "GUE_Soldier_CO_DZ";
  61. }else{////18
  62. _model = _model;
  63. };////18
  64. };////17
  65. };////16
  66. };////15
  67. };////14
  68. };////13
  69. };////12
  70. };////11
  71. };////10
  72. };////9
  73. };////8
  74. };////7
  75. };////6
  76. };////5
  77. };////4
  78. };////3
  79. };////2
  80. };
  81. };
  82. };
  83. };
  84. };
  85. };
  86. };
  87. };
  88. };
  89. };
  90.  
  91. _count = (({isPlayer _x} count (nearestObjects [player, ["CAManBase"], 5])) - 1);
  92.  
  93. switch (_model) do {
  94.     case "Survivor3_DZ": {
  95.         _model = "Survivor2_DZ";
  96.     };
  97. };
  98.  
  99. _isModel = _model in AllPlayers;
  100.  
  101. if (_count > 0) exitWith {
  102.     _txt = "You can't take clothes from a body when a player is within 5m of you!";
  103.     cutText [_txt,"PLAIN DOWN"];
  104.     systemChat ("Zupa: "+str _txt+"");
  105. };
  106. if !(_isModel) then {
  107.     _txt = "These clothes can not be taken!";
  108.     cutText [txt,"PLAIN DOWN"];
  109.     systemChat ("Zupa: "+str _txt+"");
  110. };
  111. if (_model in ["Survivor2_DZ"]) then {
  112.     _txt = "These clothes can not be taken!";
  113.     cutText [txt,"PLAIN DOWN"];
  114.     systemChat ("Zupa: "+str _txt+"");
  115. };
  116.  
  117.  
  118.  
  119. if (_isModel &&  !(_model in ["Survivor2_DZ"])) then {
  120.     _model = "Skin_" + _model;
  121.     _result = [player,_model] call BIS_fnc_invAdd;
  122.     if (_result) then {
  123.         player playActionNow "PutDown";
  124.         private["_name","_method"];
  125.         _name = _body getVariable["bodyName","unknown"];
  126.         _method = _body getVariable["deathType","unknown"];
  127.         _money = _body getVariable["cashMoney",0];
  128.         _class = "Survivor2_DZ";
  129.         _position = getPosATL _body;
  130.         _dir = getDir _body;
  131.         //---------_currentAnim = animationState _body;
  132.         private ["_weapons","_magazines","_primweapon","_secweapon"];
  133.         _weapons = weapons _body;
  134.         _primweapon = primaryWeapon _body;
  135.         _secweapon = secondaryWeapon _body;
  136.         if (!(_primweapon in _weapons) && _primweapon != "") then {_weapons = _weapons + [_primweapon];};
  137.         if (!(_secweapon in _weapons) && _secweapon != "") then {_weapons = _weapons + [_secweapon];};
  138.         _magazines = magazines _body;
  139.         private ["_newBackpackType","_backpackWpn","_backpackMag"];
  140.         dayz_myBackpack = unitBackpack _body;
  141.         if (isNull (unitBackpack _body)) then {
  142.             _hasBackPack = false;
  143.         } else {
  144.             _hasBackPack = true;
  145.             _newBackpackType = typeOf dayz_myBackpack;
  146.             _backpackWpn = getWeaponCargo dayz_myBackpack;
  147.             _backpackMag = getMagazineCargo dayz_myBackpack;
  148.         };
  149.         _currentWpn = currentWeapon _body;
  150.         _muzzles = getArray(configFile >> "cfgWeapons" >> _currentWpn >> "muzzles");
  151.         if (count _muzzles > 1) then {_currentWpn = currentMuzzle _body;};
  152.         _body setPosATL dayz_spawnPos;
  153.         _oldUnit = _body;
  154.         _group = createGroup west;
  155.         _newUnit = _group createUnit [_class,position player,[],0,"NONE"];
  156.         _newUnit setPosATL _position;
  157.         _newUnit setDir _dir;
  158.         {_newUnit removeMagazine _x;} forEach magazines _newUnit;
  159.         removeAllWeapons _newUnit;
  160.         {if (typeName _x == "ARRAY") then {_newUnit addMagazine [_x select 0,_x select 1];} else {_newUnit addMagazine _x;};} forEach _magazines;
  161.         {_newUnit addWeapon _x;} forEach _weapons;
  162.         if (str(_weapons) != str(weapons _newUnit)) then {
  163.             {_weapons = _weapons - [_x];} forEach (weapons _newUnit);
  164.             {_newUnit addWeapon _x;} forEach _weapons;
  165.         };
  166.         if (_primweapon != (primaryWeapon _newUnit)) then { _newUnit addWeapon _primweapon; };
  167.         if (_secweapon != (secondaryWeapon _newUnit) && _secweapon != "") then { _newUnit addWeapon _secweapon; };
  168.         if (_hasBackPack) then {
  169.             _newUnit addBackpack _newBackpackType;
  170.             _oldBackpack = dayz_myBackpack;
  171.             dayz_myBackpack = unitBackpack _newUnit;
  172.             _backpackWpnTypes = [];
  173.             _backpackWpnQtys = [];
  174.             if (count _backpackWpn > 0) then {
  175.                 _backpackWpnTypes = _backpackWpn select 0;
  176.                 _backpackWpnQtys = _backpackWpn select 1;
  177.             };
  178.             _countr = 0;
  179.             {
  180.                 dayz_myBackpack addWeaponCargoGlobal [_x,(_backpackWpnQtys select _countr)];
  181.                 _countr = _countr + 1;
  182.             } forEach _backpackWpnTypes;
  183.             _backpackmagTypes = [];
  184.             _backpackmagQtys = [];
  185.             if (count _backpackmag > 0) then {
  186.                 _backpackmagTypes   = _backpackMag select 0;
  187.                 _backpackmagQtys    = _backpackMag select 1;
  188.             };
  189.             _countr = 0;
  190.             {
  191.                 dayz_myBackpack addmagazineCargoGlobal [_x,(_backpackmagQtys select _countr)];
  192.                 _countr = _countr + 1;
  193.             } forEach _backpackmagTypes;
  194.         };
  195.         removeAllWeapons _oldUnit;
  196.         {
  197.             _oldUnit removeMagazine _x;
  198.         } forEach magazines _oldUnit;
  199.         deleteVehicle _oldUnit;
  200.         _oldUnit = nil;
  201.         _newUnit setDamage 1;
  202.         _newUnit setVariable["bodyName",_name,true];
  203.         _newUnit setVariable["deathType",_method,true];
  204.         _newUnit setVariable["cashMoney",_money,true];
  205.     } else {cutText ["You need a free slot to take clothing.", "PLAIN DOWN"];};
  206. };
RAW Paste Data