Advertisement
Guest User

Untitled

a guest
Jun 21st, 2015
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.50 KB | None | 0 0
  1. private ["_humanity","_weapons","_backpackWpn","_backpackMag","_currentWpn","_backpackWpnTypes","_backpackWpnQtys","_countr","_class","_position","_dir","_currentAnim","_tagSetting","_playerUID","_countMags","_magazines","_primweapon","_secweapon","_newBackpackType","_muzzles","_oldUnit","_group","_newUnit","_playerObjName","_wpnType","_ismelee"];
  2. disableSerialization;
  3. //Старт заставки
  4. startLoadingScreen ["Смена скина", "DayZ_loadingScreen"];
  5. call dayz_forceSave;
  6. //заставка
  7. progressLoadingScreen 0.2;
  8.  
  9. _class = _this;
  10. _position = getPosATL player;
  11. _dir = getDir player;
  12. _currentAnim = animationState player;
  13. _tagSetting = player getVariable["DZE_display_name",false];
  14. _playerUID = getPlayerUID player;
  15. _weapons = weapons player;
  16. _zupaMags = magazines player;
  17. _countMags = call player_countMagazines;
  18. _magazines = _countMags select 0;
  19. _cashMoney = player getVariable["cashMoney",0];
  20. _bankMoney = player getVariable["bankMoney",0];
  21. _cashMoney2 = player getVariable["headShots",0];
  22. _bankMoney2 = player getVariable["bank",0];
  23. _humanity = player getVariable["humanity",0];
  24. _cId = player getVariable["CharacterID",0];
  25.  
  26. if ((_playerUID == dayz_playerUID) && (count _magazines == 0) && (count (magazines player) > 0 )) exitWith {cutText [(localize "str_epoch_player_17"), "PLAIN DOWN"]};
  27.  
  28. _primweapon = primaryWeapon player;
  29. _secweapon = secondaryWeapon player;
  30.  
  31. if(!(_primweapon in _weapons) && _primweapon != "") then {
  32. _weapons = _weapons + [_primweapon];
  33. };
  34.  
  35. if(!(_secweapon in _weapons) && _secweapon != "") then {
  36. _weapons = _weapons + [_secweapon];
  37. };
  38.  
  39. //BackUp Backpack
  40. dayz_myBackpack = unitBackpack player;
  41. _newBackpackType = (typeOf dayz_myBackpack);
  42. if(_newBackpackType != "") then {
  43. _backpackWpn = getWeaponCargo unitBackpack player;
  44. _backpackMag = _countMags select 1;
  45. };
  46.  
  47. //Get Muzzle
  48. _currentWpn = currentWeapon player;
  49. _muzzles = getArray(configFile >> "cfgWeapons" >> _currentWpn >> "muzzles");
  50. if (count _muzzles > 1) then {
  51. _currentWpn = currentMuzzle player;
  52. };
  53.  
  54. //Secure Player for Transformation
  55. player setPosATL dayz_spawnPos;
  56.  
  57. //BackUp Player Object
  58. _oldUnit = player;
  59. _oldGroup = group player;
  60.  
  61. /**********************************/
  62. //DONT USE player AFTER THIS POINT//
  63. /**********************************/
  64.  
  65. //Create New Character
  66. _group = createGroup west;
  67. _newUnit = _group createUnit [_class,dayz_spawnPos,[],0,"NONE"];
  68. [_newUnit] joinSilent createGroup WEST;
  69. _newUnit setPosATL _position;
  70. _newUnit setDir _dir;
  71.  
  72. //Clear New Character
  73. removeAllWeapons _newUnit;
  74. removeAllItems _newUnit;
  75. removebackpack _newUnit;
  76.  
  77. //загрузка
  78. progressLoadingScreen 0.4;
  79.  
  80. //Equip New Charactar
  81. {
  82. if (typeName _x == "ARRAY") then {if ((count _x) > 0) then {_newUnit addMagazine [(_x select 0), (_x select 1)]; }; } else { _newUnit addMagazine _x; };
  83. } count _magazines;
  84.  
  85. {
  86. _newUnit addWeapon _x;
  87. } count _weapons;
  88.  
  89. //Check && Compare it
  90. if(str(_weapons) != str(weapons _newUnit)) then {
  91. //Get Differecnce
  92. {
  93. _weapons = _weapons - [_x];
  94. } count (weapons _newUnit);
  95.  
  96. //Add the Missing
  97. {
  98. _newUnit addWeapon _x;
  99. } count _weapons;
  100. };
  101.  
  102. if(_primweapon != (primaryWeapon _newUnit)) then {
  103. _newUnit addWeapon _primweapon;
  104. };
  105. if (_primweapon == "MeleeCrowbar") then {
  106. _newUnit addMagazine 'crowbar_swing';
  107. };
  108. if (_primweapon == "MeleeSledge") then {
  109. _newUnit addMagazine 'sledge_swing';
  110. };
  111. if (_primweapon == "MeleeHatchet_DZE") then {
  112. _newUnit addMagazine 'Hatchet_Swing';
  113. };
  114. if (_primweapon == "MeleeMachete") then {
  115. _newUnit addMagazine 'Machete_swing';
  116. };
  117. if (_primweapon == "MeleeFishingPole") then {
  118. _newUnit addMagazine 'Fishing_Swing';
  119. };
  120.  
  121. if(_secweapon != (secondaryWeapon _newUnit) && _secweapon != "") then {
  122. _newUnit addWeapon _secweapon;
  123. };
  124.  
  125. if(isNil "_cashMoney")then{_cashMoney = 0;};
  126. if(isNil "_bankMoney")then{_bankMoney = 0;};
  127. if(isNil "_cashMoney2")then{_cashMoney2 = 0;};
  128. if(isNil "_bankMoney2")then{_bankMoney2 = 0;};
  129. //загрузка
  130. progressLoadingScreen 0.6;
  131.  
  132. _newUnit setVariable ["cashMoney",_cashMoney,true];
  133. _newUnit setVariable ["bankMoney",_bankMoney];
  134.  
  135. _newUnit setVariable ["headShots",_cashMoney2,true];
  136. _newUnit setVariable ["bank",_bankMoney2];
  137.  
  138. _newUnit setVariable["CharacterID",_cId,true];
  139.  
  140. _switchUnit = {
  141. addSwitchableUnit _newUnit;
  142. setPlayable _newUnit;
  143. selectPlayer _newUnit;
  144. if ((count units _oldGroup > 1) && {!isNil "PVDZE_plr_LoginRecord"}) then {
  145. [_newUnit] join _oldGroup;
  146. if (count units _group < 1) then {deleteGroup _group;};
  147. };
  148. removeAllWeapons _oldUnit;
  149. {_oldUnit removeMagazine _x;} count magazines _oldUnit;
  150. deleteVehicle _oldUnit;
  151. if(_currentWpn != "") then {_newUnit selectWeapon _currentWpn;};
  152. };
  153.  
  154. //Add && Fill BackPack
  155. removeBackpack _newUnit;
  156.  
  157. if (!isNil "_newBackpackType") then {
  158. if (_newBackpackType != "") then {
  159. _newUnit addBackpack _newBackpackType;
  160. dayz_myBackpack = unitBackpack _newUnit;
  161. //Weapons
  162. _backpackWpnTypes = [];
  163. _backpackWpnQtys = [];
  164. if (count _backpackWpn > 0) then {
  165. _backpackWpnTypes = _backpackWpn select 0;
  166. _backpackWpnQtys = _backpackWpn select 1;
  167. };
  168. [] call _switchUnit;
  169. if (gear_done) then {sleep 0.001;};
  170. ["1"] call gearDialog_create;
  171. //magazines
  172. _countr = 0;
  173. {
  174. if (!(isClass(configFile >> "CfgWeapons" >> _x))) then {
  175. _countr = _countr + 1;
  176. if ((typeName _x) != "STRING") then {
  177. (unitBackpack player) addMagazineCargoGlobal [(_x select 0), 1];
  178. _idc = 4999 + _countr;
  179. _idc setIDCAmmoCount (_x select 1);
  180. } else {
  181. (unitBackpack player) addMagazineCargoGlobal [_x, 1];
  182. };
  183. };
  184. } count _backpackMag;
  185. (findDisplay 106) closeDisplay 0;
  186. _countr = 0;
  187. {
  188. (unitBackpack player) addWeaponCargoGlobal [_x,(_backpackWpnQtys select _countr)];
  189. _countr = _countr + 1;
  190. } count _backpackWpnTypes;
  191. } else { [] call _switchUnit; };
  192. } else { [] call _switchUnit; };
  193. [objNull, player, rSwitchMove,_currentAnim] call RE;
  194. player disableConversation true;
  195.  
  196. {
  197. if( !(_x in _weapons))then {
  198. [_x] call player_checkAndRemoveItems;
  199. };
  200. }count (weapons player);
  201. {
  202. if( !(_x in _zupaMags))then {
  203. [_x] call player_checkAndRemoveItems;
  204. };
  205. }count (magazines player);
  206.  
  207. //player setVariable ["bodyName",dayz_playerName,true]; //Outcommit (Issue #991) - Also removed in DayZ Mod 1.8
  208.  
  209. //загрузка
  210. progressLoadingScreen 0.8;
  211.  
  212.  
  213. player setVariable ["cashMoney",_cashMoney,true];
  214. player setVariable ["bankMoney",_bankMoney];
  215. player setVariable ["headShots",_cashMoney2,true];
  216. player setVariable ["bank",_bankMoney2];
  217. player setVariable ["CharacterID",_cId,true];
  218. player setVariable ["humanity",_humanity,true];
  219. if (_tagSetting) then {
  220. DZE_ForceNameTags = true;
  221. };
  222.  
  223. _playerUID = getPlayerUID player;
  224. _playerObjName = format["PVDZE_player%1",_playerUID];
  225. call compile format["%1 = player;",_playerObjName];
  226. publicVariableServer _playerObjName; //Outcommit in DayZ 1.8 No clue for what this is - Skaronator
  227.  
  228. //melee check
  229. _wpnType = primaryWeapon player;
  230. _ismelee = (gettext (configFile >> "CfgWeapons" >> _wpnType >> "melee"));
  231. if (_ismelee == "true") then {
  232. call dayz_meleeMagazineCheck;
  233. };
  234.  
  235. //reveal the same objects we do on login
  236. {player reveal _x} count (nearestObjects [getPosATL player, dayz_reveal, 50]);
  237. player setVariable ["cashMoney",_cashMoney,true];
  238. //Загрузка
  239. progressLoadingScreen 1.0;
  240. endLoadingScreen;
  241.  
  242. systemChat format ["Вы сменили скин на: %1",(typeOf player)];
  243. cutText ["\n\n Вы сменили скин на: " + (typeOf player), "PLAIN DOWN"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement