Advertisement
Halvhjearne

player_wearClothes.sqf

Dec 23rd, 2013
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.04 KB | None | 0 0
  1. /*
  2. _item spawn player_wearClothes;
  3. Added Female skin changes - DayZ Epoch - vbawol
  4. Removed backpack check and remove/add backpack after skinswitch (if needed) by HALV
  5. */
  6. private ["_item","_onLadder","_hasclothesitem","_config","_text","_myModel","_itemNew","_currentSex","_newSex","_model","_playerNear"];
  7.  
  8. if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_83") , "PLAIN DOWN"] };
  9. DZE_ActionInProgress = true;
  10.  
  11. _item = _this;
  12. call gear_ui_init;
  13. _onLadder =     (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
  14. if (_onLadder) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_player_21") , "PLAIN DOWN"]};
  15. _hasclothesitem = _this in magazines player;
  16. _config = configFile >> "CfgMagazines";
  17. _text = getText (_config >> _item >> "displayName");
  18. if (!_hasclothesitem) exitWith { DZE_ActionInProgress = false; cutText [format[(localize "str_player_31"),_text,"wear"] , "PLAIN DOWN"]};
  19. if (vehicle player != player) exitWith { DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_85"), "PLAIN DOWN"]};
  20. //if (!isNull (unitBackpack player)) exitWith { DZE_ActionInProgress = false; cutText ["\n\nUnable to change clothes while wearing backpack.", "PLAIN DOWN"] };
  21. if ("CSGAS" in (magazines player)) exitWith { DZE_ActionInProgress = false; cutText ["\n\nUnable to change clothes while carrying a filled chainsaw.", "PLAIN DOWN"] };
  22. _myModel = (typeOf player);
  23. _itemNew = "Skin_" + _myModel;
  24. //diag_log ("Debug Clothes: model In: " + str(_itemNew) + " Out: " + str(_item));
  25. if ( (isClass(_config >> _itemNew)) ) then {
  26.     if ( (isClass(_config >> _item)) ) then {
  27.         // Current sex of player skin
  28.         _currentSex = getText (configFile >> "CfgSurvival" >> "Skins" >> _itemNew >> "sex");
  29.         // Sex of new skin
  30.         _newSex = getText (configFile >> "CfgSurvival" >> "Skins" >> _item >> "sex");
  31.         //diag_log ("Debug Clothes: sex In: " + str(_currentSex) + " Out: " + str(_newSex));
  32.         if(_currentSex == _newSex) then {
  33.             // Get model name from config
  34.             _model = getText (configFile >> "CfgSurvival" >> "Skins" >> _item >> "playerModel");
  35.             if (_model != _myModel) then {
  36.                 if(([player,_item] call BIS_fnc_invRemove) == 1) then {
  37.                     player addMagazine _itemNew;
  38.                     _dayz_myBackpack = unitBackpack player;
  39.                     _Backpack = (typeOf _dayz_myBackpack);
  40.                     _WeCargo = "";
  41.                     _MaCargo = "";
  42.                     if (_Backpack !="") then {
  43.                         _WeCargo = getWeaponCargo Unitbackpack player;
  44.                         _MaCargo = getMagazineCargo Unitbackpack player;
  45. diag_log format["HALV_EXCHANGE: Got cargo & removed Backpack, ready to switch (%1) %8 (%2) %3 %4 %5 %6 %7",dayz_playerName,_model,_currentSex,_dayz_myBackpack,_Backpack,_WeCargo,_MaCargo,_myModel];
  46.                         removeBackpack player;
  47.                     };
  48.                     [dayz_playerUID,dayz_characterID,_model] spawn player_humanityMorph;
  49.                     if (_Backpack !="") then {
  50.                         titleText [format["Switching Backpack pack, pls wait ..."], "PLAIN DOWN"];titlefadeout 3;
  51.                         sleep 3;
  52.                         player addBackpack _Backpack;
  53.                         //Weapons
  54.                         _WeTypes = [];
  55.                         _WeCount = [];
  56.                         if (count _WeCargo > 0) then {_WeTypes = _WeCargo select 0;_WeCount = _WeCargo select 1;};
  57.                         _countr = 0;
  58.                         {(Unitbackpack player) addWeaponCargoGlobal [_x,(_WeCount select _countr)];_countr = _countr + 1;} forEach _WeTypes;
  59.                         //Magazines
  60.                         _MaTypes = [];
  61.                         _MaCount = [];
  62.                         if (count _MaCargo > 0) then {_MaTypes = _MaCargo select 0;_MaCount = _MaCargo select 1;};
  63.                         _countr = 0;
  64.                         {(Unitbackpack player) addmagazinecargoGlobal [_x,(_MaCount select _countr)];_countr = _countr + 1;} forEach _MaTypes;
  65.                         _WeCargo1 = getWeaponCargo (Unitbackpack player);
  66.                         _MaCargo1 = getMagazineCargo (Unitbackpack player);
  67. diag_log format["HALV_EXCHANGE: Done - Backpack stuff changed to next bag and added to player (%1) %8 (%2) %3 %4 %5 %6 %7",dayz_playerName,_model,_currentSex,_dayz_myBackpack,_Backpack,_WeCargo,_MaCargo,_myModel];
  68.                     };
  69.                 };
  70.             };
  71.         } else {
  72.             cutText [(localize "str_epoch_player_86"), "PLAIN DOWN"];
  73.         };
  74.     };
  75. };
  76. DZE_ActionInProgress = false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement