Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2013
502
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.52 KB | None | 0 0
  1. // Created by [GEEK SQUAD]Churchie
  2. // Contributors to getting it working are:| cyrq | Manatee Hunter | Deasil | OnlyblackSurvivor | Thank you!
  3. player removeAction s_clothes;
  4. s_clothes = -1;
  5. private["_body","_result"];
  6. _body = _this select 3;
  7. _model = typeOf _body;
  8. if( _model in ["Sniper1_DZ","Camo1_DZ"] ) then { _model = "Skin_" + _model;
  9. _rnd = random 1;
  10. if (_rnd > 0.6) then {
  11. _result = [player,_model] call BIS_fnc_invAdd;
  12. }
  13. else {
  14. _model = "Skin_Survivor2_DZ";
  15. _result = [player,_model] call BIS_fnc_invAdd;
  16. cutText ["The clothing tears as you try to remove it from the corpse", "PLAIN DOWN"];
  17. };
  18. if (_result) then { player playActionNow "PutDown";
  19. private["_name","_method","_methodStr"];
  20. _isGutted = _body getVariable["meatHarvested",false];
  21. _name = _body getVariable["bodyName","unknown"];
  22. _method = _body getVariable["deathType","unknown"];
  23. _methodStr = localize format ["str_death_%1",_method];
  24. _class = "Survivor2_DZ";
  25. _position = getPosATL _body;
  26. _dir = getDir _body;
  27. _currentAnim = animationState
  28. _body; private ["_weapons","_magazines","_primweapon","_secweapon"];
  29. _weapons = weapons _body;
  30. _primweapon = primaryWeapon
  31. _body; _secweapon = secondaryWeapon _body;
  32. if(!(_primweapon in _weapons) && _primweapon != "") then { _weapons = _weapons + [_primweapon]; };
  33. if(!(_secweapon in _weapons) && _secweapon != "") then { _weapons = _weapons + [_secweapon]; };
  34. _magazines = magazines _body;
  35. private ["_newBackpackType","_backpackWpn","_backpackMag"]; dayz_myBackpack = unitBackpack _body;
  36. _newBackpackType = (typeOf dayz_myBackpack);
  37. if(_newBackpackType != "") then { _backpackWpn = getWeaponCargo unitBackpack _body;
  38. _backpackMag = getMagazineCargo unitBackpack _body; };
  39. _currentWpn = currentWeapon _body;
  40. _muzzles = getArray(configFile >> "cfgWeapons" >> _currentWpn >> "muzzles");
  41. if (count _muzzles > 1) then { _currentWpn = currentMuzzle _body; };
  42. diag_log "Attempting to switch model";
  43. diag_log str(_weapons);
  44. diag_log str(_magazines);
  45. diag_log (str(_backpackWpn));
  46. diag_log (str(_backpackMag));
  47. _body setPosATL dayz_spawnPos;
  48. _oldUnit = _body;
  49. _group = createGroup west;
  50. _newUnit = _group createUnit [_class,position player,[],0,"NONE"];
  51. _newUnit setPosATL _position;
  52. _newUnit setDir _dir; {_newUnit removeMagazine _x;} forEach magazines _newUnit;
  53. removeAllWeapons _newUnit; {
  54. if (typeName _x == "ARRAY") then {_newUnit addMagazine [_x select 0,_x select 1]
  55. } else { _newUnit addMagazine _x };
  56. } forEach _magazines; { _newUnit addWeapon _x; } forEach _weapons;
  57. if(str(_weapons) != str(weapons _newUnit)) then { { _weapons = _weapons - [_x];
  58. } forEach (weapons _newUnit); {
  59. _newUnit addWeapon _x;
  60. } forEach _weapons; };
  61. if(_primweapon != (primaryWeapon _newUnit)) then { _newUnit addWeapon _primweapon; };
  62. if(_secweapon != (secondaryWeapon _newUnit) && _secweapon != "") then { _newUnit addWeapon _secweapon; };
  63. if (!isNil "_newBackpackType") then {
  64. if (_newBackpackType != "") then { _newUnit addBackpack _newBackpackType;
  65. _oldBackpack = dayz_myBackpack; dayz_myBackpack = unitBackpack _newUnit; _backpackWpnTypes = [];
  66. _backpackWpnQtys = [];
  67. if (count _backpackWpn > 0) then { _backpackWpnTypes = _backpackWpn select 0;
  68. _backpackWpnQtys = _backpackWpn select 1; };
  69. _countr = 0; { dayz_myBackpack addWeaponCargoGlobal [_x,(_backpackWpnQtys select _countr)];
  70. _countr = _countr + 1;
  71. } forEach _backpackWpnTypes;
  72. _backpackmagTypes = [];
  73. _backpackmagQtys = [];
  74. if (count _backpackmag > 0) then { _backpackmagTypes =
  75. _backpackMag select 0;
  76. _backpackmagQtys = _backpackMag select 1; };
  77. _countr = 0; { dayz_myBackpack addmagazineCargoGlobal [_x,(_backpackmagQtys select _countr)];
  78. _countr = _countr + 1;
  79. } forEach _backpackmagTypes; }; };
  80. diag_log "Taking Clothes. Equipment:";
  81. diag_log str(weapons _newUnit); diag_log str(magazines _newUnit);
  82. diag_log str(getWeaponCargo unitBackpack _newUnit);
  83. diag_log str(getMagazineCargo unitBackpack _newUnit);
  84. removeAllWeapons _oldUnit; {_oldUnit removeMagazine _x;
  85. } forEach magazines _oldUnit; deleteVehicle _oldUnit;
  86. _newUnit setDamage 1;
  87. _newUnit setVariable["bodyName",_name,true];
  88. _newUnit setVariable["deathType",_method,true];
  89. if (_isGutted) then {
  90. _newUnit setVariable["meatHarvested",true,true];
  91. };
  92. } else {
  93. cutText ["You need a free slot to take clothing.", "PLAIN DOWN"];
  94. };
  95. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement