Advertisement
Guest User

Untitled

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