Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 49.61 KB | None | 0 0
  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8. scriptName "Functions\initFunctions.sqf";
  9.  
  10. call compile preprocessFileLineNumbers "dz\modulesDayz\init.sqf";
  11.  
  12. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  13.  
  14. new_queued = compile preprocessFileLineNumbers "\dz\modulesDayZ\scripts\player_queued.sqf";
  15. [] spawn {
  16. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  17. if(!isNil "menu") exitWith {hint "menu already ran";};
  18. menu = true;
  19. hint "GO";
  20. [] spawn {
  21. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  22. while{true} do {
  23. waitUntil{!(isNil "clientReady")};
  24. PLAYER_ID = clientReady;
  25. };
  26. };
  27. [] spawn {
  28. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  29. hint "instant respawn started";
  30. while{true} do {
  31. player_queued = {
  32. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  33. _id = _this select 0;
  34. _this set[6,0];
  35. hint 'respawning you instantly!';
  36. _this call new_queued;
  37. };
  38. };
  39. };
  40. hint "menu init";
  41.  
  42. [] spawn {
  43. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  44. kk_fnc_inString = {
  45. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  46. private ["_needle","_haystack","_needleLen","_hay","_found"];
  47. _needle = [_this, 0, "", [""]] call BIS_fnc_param;
  48. _haystack = toArray ([_this, 1, "", [""]] call BIS_fnc_param);
  49. _needleLen = count toArray _needle;
  50. _hay = toArray ([_this, 1, "", [""]] call BIS_fnc_param);
  51. _hay resize _needleLen;
  52. _found = false;
  53. for "_i" from _needleLen to count _haystack do {
  54. if (toString _hay == _needle) exitWith {_found = true};
  55. _hay set [_needleLen, _haystack select _i];
  56. _hay set [0, "x"];
  57. _hay = _hay - ["x"]
  58. };
  59. _found
  60. };
  61.  
  62. W34p0ns = [];
  63. F0od_Dr1nk = [];
  64. M3d1c4l = [];
  65. T0ol_it3ms = [];
  66. amm0 = [];
  67. It3m5 = [];
  68. Att4chm3nt = [];
  69. Cl0th1ng = [];
  70. B4ckp4cks = [];
  71. A11 = [];
  72.  
  73. _magazines = [] spawn {
  74. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  75. systemchat "<John>: Loading Magazine Config";
  76. _configFile = configFile >> "cfgMagazines";
  77. for "_i" from 0 to count(_configFile) do {
  78. _cfg = _configFile select _i;
  79. if(isClass _cfg) then {
  80. _class = configName _cfg;
  81. _scope = getNumber(_cfg >> "scope");
  82. if(_scope == 2) then {
  83. amm0 = amm0 + [_class];
  84. };
  85. };
  86. };
  87. };
  88. _weapons = [] spawn {
  89. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  90. systemchat "<John>: Loading Weapon Config";
  91. _configFile = configFile >> "cfgWeapons";
  92. for "_i" from 0 to count(_configFile) do {
  93. _cfg = _configFile select _i;
  94. if(isClass _cfg) then {
  95. _class = configName _cfg;
  96. _scope = getNumber(_cfg >> "scope");
  97. if(_scope == 2) then {
  98. W34p0ns = W34p0ns + [_class];
  99. };
  100. };
  101. };
  102. };
  103. _everythingelse = [] spawn {
  104. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  105. systemchat "<John>: Loading Item Config";
  106. _configFile = configFile >> "cfgVehicles";
  107. _pcheck = 0;
  108. for "_i" from 0 to count(_configFile)-1 do {
  109. _percent = round((_i / (count(_configFile)-1))*100);
  110. if(_percent != _pcheck) then {
  111. _pcheck = _percent;
  112. systemchat ("<John>: Loading Item Config("+str(_percent)+"%)")
  113. };
  114. _cfg = _configFile select _i;
  115. if(isClass _cfg) then {
  116. _class = configName _cfg;
  117.  
  118. _scope = getNumber(_cfg >> "Scope");
  119. if(_scope == 2) then {
  120.  
  121. if(["Ammo_",_class] call kk_fnc_inString) then {
  122. amm0 = amm0 + [_class];
  123. };
  124.  
  125. if(["Food_",_class] call kk_fnc_inString) then {
  126. F0od_Dr1nk = F0od_Dr1nk + [_class];
  127. };
  128. if(["Drink_",_class] call kk_fnc_inString) then {
  129. F0od_Dr1nk = F0od_Dr1nk + [_class];
  130. };
  131.  
  132. if(["Medical_",_class] call kk_fnc_inString) then {
  133. T0ol_it3ms = T0ol_it3ms + [_class];
  134. };
  135.  
  136. if(["Tool_",_class] call kk_fnc_inString) then {
  137. T0ol_it3ms = T0ol_it3ms + [_class];
  138. };
  139. if(["Pen_",_class] call kk_fnc_inString) then {
  140. T0ol_it3ms = T0ol_it3ms + [_class];
  141. };
  142.  
  143. if(["Attachment_",_class] call kk_fnc_inString) then {
  144. Att4chm3nt = Att4chm3nt + [_class];
  145. };
  146.  
  147. if(_class isKindOf "VestBase") then {
  148. Cl0th1ng = Cl0th1ng + [_class];
  149. };
  150. if(_class isKindOf "TopwearBase") then {
  151. Cl0th1ng = Cl0th1ng + [_class];
  152. };
  153. if(_class isKindOf "BottomwearBase") then {
  154. Cl0th1ng = Cl0th1ng + [_class];
  155. };
  156. if(_class isKindOf "FootwearBase") then {
  157. Cl0th1ng = Cl0th1ng + [_class];
  158. };
  159.  
  160. if(_class isKindOf "BagBase") then {
  161. B4ckp4cks = B4ckp4cks + [_class];
  162. };
  163.  
  164. if(["Container_",_class] call kk_fnc_inString) then {
  165. It3m5 = It3m5 + [_class];
  166. };
  167. if(["Optics_",_class] call kk_fnc_inString) then {
  168. It3m5 = It3m5 + [_class];
  169. };
  170. if(["Crafting_",_class] call kk_fnc_inString) then {
  171. It3m5 = It3m5 + [_class];
  172. };
  173. if(["Map_",_class] call kk_fnc_inString) then {
  174. It3m5 = It3m5 + [_class];
  175. };
  176. if(["Compass",_class] call kk_fnc_inString) then {
  177. It3m5 = It3m5 + [_class];
  178. };
  179. if(["Light_",_class] call kk_fnc_inString) then {
  180. It3m5 = It3m5 + [_class];
  181. };
  182. if(["Cookware_",_class] call kk_fnc_inString) then {
  183. It3m5 = It3m5 + [_class];
  184. };
  185. if(["Fireplace_",_class] call kk_fnc_inString) then {
  186. It3m5 = It3m5 + [_class];
  187. };
  188. if(["Cooker_",_class] call kk_fnc_inString) then {
  189. It3m5 = It3m5 + [_class];
  190. };
  191. if(["Consumable_",_class] call kk_fnc_inString) then {
  192. It3m5 = It3m5 + [_class];
  193. };
  194. };
  195.  
  196. };
  197. };
  198. };
  199. waitUntil{scriptdone _magazines && scriptdone _weapons && scriptdone _everythingelse};
  200. A11 = W34p0ns + amm0 + Att4chm3nt + F0od_Dr1nk + M3d1c4l + T0ol_it3ms + B4ckp4cks + It3m5 + Cl0th1ng;
  201. };
  202. waitUntil{!isNull player};
  203. waitUntil{alive player};
  204. hint 'player found';
  205.  
  206. players = [];
  207. whitelist = [];
  208.  
  209. ['Anti-BlackScreen & DisabledInput'] spawn {
  210. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  211. while{true} do {
  212. disableuserinput false;
  213. titleText ["", "PLAIN", 2];
  214. titleFadeOut 0.1;
  215. setAperture -1;
  216. 0 fadeSound 1;
  217. 0 fadeSpeech 1;
  218. 0 fadeRadio 1;
  219. };
  220. };
  221. _menu = {
  222. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  223. ['Maintain Player List'] spawn {
  224. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  225. while{true} do {
  226. _players = player nearEntities ["SurvivorBase",1000];
  227. players = _players;
  228. sleep 10;
  229. };
  230. };
  231. ['Overhead Advert'] spawn {
  232. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  233. while{true} do {
  234. 0 cutRsc ['RscTitleStructuredText', 'PLAIN'];
  235. _display = uinamespace getvariable ['RscTitleStructuredText',displaynull];
  236. _ctrl = _display displayctrl 9999;
  237. _ctrl ctrlShow true;
  238. _ctrl ctrlEnable true;
  239. _ctrl ctrlSetFade 0;
  240. _ctrl ctrlsettextcolor [0,1,1,1];
  241. _ctrl ctrlSetPosition [safezonex,safezoney,safezonew,safezoneH];
  242. _ctrl ctrlSetStructuredText parseText "<t color='#00FFFF'> </t>";
  243. _ctrl ctrlcommit 0;
  244. uiSleep 9;
  245. };
  246. };
  247. ['Variables'] call {
  248. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  249. toggle_1 = false;
  250. toggle_5 = false;
  251. toggle_6 = false;
  252. toggle_2 = false;
  253. toggle_3 = false;
  254. toggle_4 = false;
  255. toggle_7 = false;
  256. toggle_8 = false;
  257. toggle_9 = false;
  258. toggle_10 = false;
  259. toggle_11 = false;
  260. toggle_12 = false;
  261. toggle_13 = false;
  262. reknearplayers_toggle = false;
  263. dayz_esp_toggle = false;
  264. dayz_esp_toggle_z = false;
  265. super_punch_toggle = false;
  266. remove_dayzed_toggle = false;
  267. remove_restrained_toggle = false;
  268. remove_rainCheck_toggle = false;
  269. nofall_toggle = false;
  270. fly_toggle = false;
  271. magnet_running = 0;
  272. devlist = ["kegan","lystic"];
  273. whitelist = devlist;
  274. };
  275. ['Scripties'] call {
  276. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  277. reknearplayers = {
  278. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  279. if(reknearplayers_toggle) then {hint 'Rek Players ON';} else {hint 'Rek Players OFF';};
  280. while{reknearplayers_toggle} do {
  281. _targets = players - [player];
  282. {
  283. if (lifeState _x != "ALIVE" && lifeState _x != "DEAD" && !(name _x in whitelist) && !(isNull _x)) then {
  284. hintSilent ("You just rekt " + name _x);
  285. respawn = _x;
  286. publicvariableserver "respawn";
  287. uiSleep 4;
  288. }
  289. } forEach _targets;
  290. };
  291. };
  292. killtarget = {
  293. _name = _this select 0;
  294. {
  295. if(name _x == _name) then {
  296. closeDialog 0;
  297. uiSleep 0.5;
  298. _pos = _x modelToWorld [0,0,2];
  299. _bullet = "GrenadeCore" createvehiclelocal _pos;
  300. _bullet setVelocity [0,0,-50000];
  301. uiSleep 0.1;
  302. };
  303. } forEach players;
  304. };
  305. nofall = {
  306. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  307. while{nofall_toggle} do {
  308. _veh = velocity player;
  309. _z = _veh select 2;
  310. if(_z < -2 && !(isTouchingGround player)) then {_veh set[2,0];player setVelocity _veh;};
  311. };
  312. };
  313. super_punch = {
  314. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  315. if(super_punch_toggle) then {
  316. super_punch_event = (findDisplay 46) displayAddEventHandler ["KeyDown",'
  317. if((_this select 1) == 41) then {
  318. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  319. _pos = player modelToWorld [0,2,1.5];
  320. _bullet = "MeleeFist" createvehiclelocal _pos;
  321. _dir = eyeDirection player;
  322. _dir2 = [(_dir select 0)*5000,(_dir select 1)*5000,(_dir select 2)*5000];
  323. _bullet setVelocity _dir2;
  324. };
  325. '];
  326. hint "Super Punch ON (hold ~ to activate)";
  327. } else {
  328. (findDisplay 46) displayRemoveEventHandler ["KeyDown",super_punch_event];
  329. hint "Super Punch OFF";
  330. };
  331. };
  332.  
  333. remove_dayzed = {
  334. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  335. if(remove_dayzed_toggle) then {
  336. "effectDazed" addPublicVariableEventhandler {};
  337. hint 'Dazed Effect Removed';
  338. } else {
  339. "effectDazed" addPublicVariableEventhandler {
  340. call dayz_bulletHit;
  341. effectDazed = false;
  342. };
  343. hint 'Dazed Effect Added';
  344. };
  345. };
  346. remove_rainCheck = {
  347. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  348. if(remove_rainCheck_toggle) then {
  349. rainCheck_bak = rainCheck;
  350. rainCheck = {};
  351. hint 'Rain Check Removed';
  352. } else {
  353. rainCheck = rainCheck_bak;
  354. hint 'Rain Check Added';
  355. };
  356. };
  357. dayz_esp_3 = {
  358. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  359. _activationDistance = 800;
  360. _drawESP = {
  361. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  362. disableserialization;
  363. _target = _this select 0;
  364. _maxDistance = _this select 1;
  365. _layer = _this select 2;
  366.  
  367. _timeToReplace = time + 9;
  368.  
  369. _layer cutRsc ['RscTitleStructuredText', 'PLAIN'];
  370. _display = uinamespace getvariable ['RscTitleStructuredText',displaynull];
  371. _ctrl = _display displayctrl 9999;
  372. _ctrl ctrlShow true;
  373. _ctrl ctrlEnable true;
  374. _ctrl ctrlSetFade 0;
  375. while{dayz_esp_toggle_z} do {
  376. _distance = player distance _target;
  377. if((_distance > _maxDistance) || !(alive _target)) exitWith {};
  378.  
  379. if(time > _timeToReplace) then {
  380. _timeToReplace = time + 9;
  381. _layer cutRsc ['RscTitleStructuredText', 'PLAIN'];
  382. _display = uinamespace getvariable ['RscTitleStructuredText',displaynull];
  383. _ctrl = _display displayctrl 9999;
  384. _ctrl ctrlShow true;
  385. _ctrl ctrlEnable true;
  386. _ctrl ctrlSetFade 0;
  387. };
  388. _pos = [(getPosATL _target) select 0, (getPosATL _target) select 1, ((getPosATL _target) select 2) + 2];
  389. _pos2D = WorldToScreen _pos;
  390. _health = round((damage _target)*100);
  391. if (count _pos2D > 0) then
  392. {
  393. _ctrl ctrlSetPosition [(_pos2D select 0) - (safezoneW / 2), (_pos2D select 1), safezoneW, safezoneH];
  394. _text = parseText format ['<t size=''0.40'' color=''#FF0000''>%1 (%2m) [HP: %3%]', "Zombie", round (player distance _target),_health];
  395. _ctrl ctrlSetStructuredText _text;
  396. _ctrl ctrlCommit 0;
  397. };
  398. uiSleep 0.05;
  399. };
  400. _layer cuttext["","PLAIN"];
  401. espZombies = espZombies - [_target];
  402. };
  403.  
  404. if(dayz_esp_toggle_z) then {
  405. hint 'Zombie ESP On!';
  406. } else {
  407. hint 'Zombie ESP Off!';
  408. };
  409.  
  410. _layer = 3000;
  411. _nearZombies = [];
  412. espZombies = [];
  413. _activationDistance = _activationDistance min 800;
  414. while{dayz_esp_toggle_z} do {
  415. _nearZombies = (getpos player) nearObjects ["ZombieBase",850];
  416. {
  417. if(alive _x) then {
  418. _distance = player distance _x;
  419. if(_distance < _activationDistance) then {
  420. if !(_x in espZombies) then {
  421. espZombies = espZombies + [_x];
  422. [_x,_activationDistance,_layer] spawn _drawESP;
  423. _layer = _layer + 1;
  424. };
  425. };
  426. };
  427. } forEach _nearZombies;
  428. };
  429. };
  430. dayz_esp_2 = {
  431. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  432. _activationDistance = 800;
  433. _drawESP = {
  434. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  435. disableserialization;
  436. _target = _this select 0;
  437. _maxDistance = _this select 1;
  438. _layer = _this select 2;
  439.  
  440. _timeToReplace = time + 9;
  441.  
  442. _layer cutRsc ['RscTitleStructuredText', 'PLAIN'];
  443. _display = uinamespace getvariable ['RscTitleStructuredText',displaynull];
  444. _ctrl = _display displayctrl 9999;
  445. _ctrl ctrlShow true;
  446. _ctrl ctrlEnable true;
  447. _ctrl ctrlSetFade 0;
  448. while{dayz_esp_toggle} do {
  449. _distance = player distance _target;
  450. if((_distance > _maxDistance) || !(alive _target)) exitWith {};
  451.  
  452. if(time > _timeToReplace) then {
  453. _timeToReplace = time + 9;
  454. _layer cutRsc ['RscTitleStructuredText', 'PLAIN'];
  455. _display = uinamespace getvariable ['RscTitleStructuredText',displaynull];
  456. _ctrl = _display displayctrl 9999;
  457. _ctrl ctrlShow true;
  458. _ctrl ctrlEnable true;
  459. _ctrl ctrlSetFade 0;
  460. };
  461. _pos = [(getPosATL _target) select 0, (getPosATL _target) select 1, ((getPosATL _target) select 2) + 2];
  462. _pos2D = WorldToScreen _pos;
  463. _health = round(((_target getVariable['blood',0])/5000)*100);
  464. _hand = (typeof (itemInHands _target));
  465. _name = name _target;
  466. _addon = "";
  467. if(toLower(_name) in whitelist) then {
  468. _addon = "<br/><t size='0.5' color='#FF69B4'>Whitelisted</t>";
  469. };
  470. if(toLower(_name) in devlist) then {
  471. _addon = "<br/><t size='0.5' color='#0000FF'>Cheat Developer</t>";
  472. };
  473. if (count _pos2D > 0) then
  474. {
  475. if !(ctrlShown _ctrl) then {
  476. _ctrl ctrlShow true;
  477. };
  478. _ctrl ctrlSetPosition [(_pos2D select 0) - (safezoneW / 2), (_pos2D select 1), safezoneW, safezoneH];
  479. _text = parseText format ['<t size=''0.40'' color=''#00FF00''>%1 (%2m) [HP: %3%]<br/>Hand: %4</t>%5', _name, round (player distance _target),_health,_hand,_addon];
  480. _ctrl ctrlSetStructuredText _text;
  481. _ctrl ctrlCommit 0;
  482. } else {
  483. if(ctrlShown _ctrl) then {
  484. _ctrl ctrlShow false;
  485. };
  486. };
  487. uiSleep 0.05;
  488. };
  489. _layer cuttext["","PLAIN"];
  490. espPlayers = espPlayers - [_target];
  491. };
  492.  
  493. if(dayz_esp_toggle) then {
  494. hint 'Player ESP On!';
  495. } else {
  496. hint 'Player ESP Off!';
  497. };
  498.  
  499. _layer = 1000;
  500. _nearPlayers = [];
  501. espPlayers = [];
  502. _activationDistance = _activationDistance min 800;
  503. while{dayz_esp_toggle} do {
  504. _nearPlayers = (getpos player) nearObjects ["SurvivorBase",850];
  505. {
  506. if(alive _x) then {
  507. _distance = player distance _x;
  508. if(_distance < _activationDistance) then {
  509. if !(_x in espPlayers) then {
  510. espPlayers = espPlayers + [_x];
  511. [_x,_activationDistance,_layer] spawn _drawESP;
  512. _layer = _layer + 1;
  513. };
  514. };
  515. };
  516. } forEach _nearPlayers;
  517. };
  518. };
  519. unrestrain = {
  520. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  521. actionReleased = player;
  522. publicVariableServer "actionReleased";
  523. };
  524. fastwalk = {
  525. (findDisplay 46) displayAddEventHandler ["KeyDown","_this select 1 call keybindz2;false;"];
  526.  
  527. keybindz = {
  528. switch (_this) do {
  529.  
  530. case 42: {
  531. johnscrpt_pos = [(getPos player select 0)+5*sin(getdir player),(getPos player select 1)+5*cos(getdir player)];
  532. player setpos johnscrpt_pos;
  533.  
  534. };
  535. };
  536. };
  537. };
  538. hidebuildings = {
  539. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  540. _objects = [];
  541.  
  542. if(toggle_13) then {hint 'Buildings are hidden!';} else {hint 'Buidlings are visible!';};
  543. while{toggle_13} do {
  544. _buildings = ((getpos player) nearobjects ["House",1000]);
  545. {
  546. if !(_x in _objects) then {
  547. _objects = _objects + [_x];
  548. _x hideObject true;
  549. };
  550. } forEach _buildings;
  551. };
  552. {
  553. _x hideObject false;
  554. } forEach _objects;
  555. };
  556. firetrail = {
  557. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  558. player setVariable ["fire",toggle_12];
  559. if(toggle_12) then {hint 'You are on fire!';} else {hint 'You are no longer on fire!';};
  560. player spawn event_fnc_fireplaceFire;
  561. };
  562. thirdperson = {
  563. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  564. if(toggle_11) then {
  565. onEachFrame {
  566. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  567. player switchCamera "External";
  568. };
  569. hint 'Third Person Mode - ON';
  570. } else {
  571. onEachFrame {};
  572. hint 'Third Person Mode - OFF';
  573. };
  574. };
  575. fastshoot = {
  576. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  577. if(toggle_8) then {hint "FAST FIRE ON!";} else {hint "FAST FIRE OFF!";};
  578. while{toggle_8} do {
  579. player setWeaponReloadingTime [player,currentWeapon player,0];
  580. sleep 0.001;
  581. };
  582. };
  583. noblurandfullcolor = {
  584. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  585. if(toggle_9) then {HINT "NO BLUR + FULL COLOR ON";} else {HINT "NO BLUR + FULL COLOR OFF";};
  586. _realblood = 0;
  587. while{toggle_9} do {
  588. resetCamShake;
  589. _realblood = player getVariable['blood',-1];
  590. player setVariable ['blood',5000];
  591. waitUntil{player getVariable ['blood',-1] != 5000};
  592. };
  593. };
  594. lysticrecoil = {
  595. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  596. if(toggle_10) then {
  597. player setUnitRecoilCoefficient 0;
  598. hint 'No Recoil - ON';
  599. } else {
  600. player setUnitRecoilCoefficient 1;
  601. hint 'No Recoil - OFF';
  602. };
  603. };
  604. addwhitelist = {
  605. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  606. _name = _this select 0;
  607. if !(tolower(_name) in whitelist) then {
  608. whitelist = whitelist + [tolower(_name)];
  609. };
  610. hint format["%1 has been whitelisted!",_name];
  611. };
  612. killme = {
  613. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  614. _unit = player;
  615. while{alive player} do {
  616. player setVelocity[0,0,1000];
  617. sleep 0.2;
  618. player setVelocity[0,0,-1000];
  619. sleep 1.5;
  620. };
  621. _unit setVelocity[0,0,10000];
  622. };
  623. executer = {
  624. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  625. closedialog 0;
  626. sleep 0.1;
  627. createdialog 'rscdisplaynote';
  628. sleep 0.2;
  629. disableSerialization;
  630. ctrlSetText[1600,'Execute'];
  631. ctrlSettext[1601,'Clear'];
  632. ctrlSetText[1300,'Bowens Script Executer'];
  633. buttonSetAction[1600,'_text = (ctrlText 1400);[] spawn compile _text;'];
  634. buttonSetAction[1601,'ctrlsetText[1400,''''];'];
  635. };
  636. timeday = {
  637. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  638. if (isnil ("loop1")) then {loop1 = 0;};
  639. if (loop1==0) then {loop1=1;cutText [format["Enabled Loop"], "PLAIN DOWN"];hint "Enabled Loop";}else
  640. {loop1=0;cutText [format["Disabled Loop"], "PLAIN DOWN"];hint "Disabled Loop";};
  641. while {loop1==1} do
  642. {
  643. setDate [2012, 9, 1, 14, 0];
  644. sleep 4;
  645. };
  646. };
  647. infammo = {
  648. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  649. if (isnil ("infammoON")) then
  650. {
  651. infammoON = 0;
  652. };
  653. if (infammoON==0) then
  654. {
  655. systemchat "Infinite Ammo ON!";
  656. infammoON=1;
  657. }
  658. else
  659. {
  660. infammoON=0;
  661. systemchat "Infinite Ammo OFF!";
  662. };
  663. sCode = " while {infammoON==1} do{(vehicle player) setVehicleAmmo 1;sleep 0.1;};";
  664. [] spawn compile sCode;
  665. };
  666. nocollide = {
  667. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  668. if(toggle_4) then {hint "NO COLLIDE ON";} else {hint "NO COLLIDE OFF";};
  669. _objects = [];
  670. while{toggle_4} do {
  671. _list = (getposatl player) nearObjects 50;
  672. {
  673. if !(_x in _objects) then {
  674. player disableCollisionWith _x;
  675. _objects = _objects + [_x];
  676. };
  677. } forEach _list;
  678. sleep 10;
  679. };
  680. {
  681. player enableCollisionWith _x;
  682. _objects = _objects - [_x];
  683. } forEach _objects;
  684. };
  685. removegrass = {
  686. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  687. if(toggle_5) then {
  688. setTerrainGrid 50.0;hint "Terrain Hack ON";
  689. } else {
  690. setTerrainGrid 12.5;hint "Terrain Hack OFF";
  691. };
  692. };
  693. norestrain = {
  694. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  695. "actionRestrained" addPublicVariableEventHandler {};
  696. };
  697. nowet = {
  698. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  699. rainCheck = {};
  700. isUnderRoof = {[0,0,0,0]};
  701. hint "No Longer Wet From Rain!";
  702. };
  703. dupebody = {
  704. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  705. if(isNil 'swagbagdupe') then {
  706. saveprofilenamespace;
  707. swagbagdupe = 2;
  708. uiSleep swagbagdupe;
  709. };
  710. clientReady = PLAYER_ID;
  711. publicVariableServer "clientReady";
  712. };
  713. magnet = {
  714. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  715.  
  716. _objects = _this select 1;
  717. _prefix = _this select 0;
  718.  
  719.  
  720. call compile format["if(isNil '%1_esp') then {%1_esp = [];};",_prefix];
  721. call compile format["if(isNil '%1_esp_t') then {%1_esp_t = false;};%1_esp_t = !%1_esp_t;",_prefix];
  722. _activationDistance = 800;
  723. _drawESP = {
  724. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  725. disableserialization;
  726. _target = _this select 0;
  727. _maxDistance = _this select 1;
  728. _layer = _this select 2;
  729. _prefix = _this select 3;
  730.  
  731. _timeToReplace = time + 9;
  732.  
  733. _layer cutRsc ['RscTitleStructuredText', 'PLAIN'];
  734. _display = uinamespace getvariable ['RscTitleStructuredText',displaynull];
  735. _ctrl = _display displayctrl 9999;
  736. _ctrl ctrlShow true;
  737. _ctrl ctrlEnable true;
  738. _ctrl ctrlSetFade 0;
  739. while{call compile format["%1_esp_t",_prefix]} do {
  740. _distance = player distance _target;
  741. if((_distance > _maxDistance) || !(alive _target)) exitWith {};
  742.  
  743. if(time > _timeToReplace) then {
  744. _timeToReplace = time + 9;
  745. _layer cutRsc ['RscTitleStructuredText', 'PLAIN'];
  746. _display = uinamespace getvariable ['RscTitleStructuredText',displaynull];
  747. _ctrl = _display displayctrl 9999;
  748. _ctrl ctrlShow true;
  749. _ctrl ctrlEnable true;
  750. _ctrl ctrlSetFade 0;
  751. };
  752. _pos = [(getPosATL _target) select 0, (getPosATL _target) select 1, ((getPosATL _target) select 2) + 2];
  753. _pos2D = WorldToScreen _pos;
  754. _health = round((damage _target)*100);
  755. if (count _pos2D > 0) then
  756. {
  757. _ctrl ctrlSetPosition [(_pos2D select 0) - (safezoneW / 2), (_pos2D select 1), safezoneW, safezoneH];
  758. _text = parseText format ['<t size=''0.40'' color=''#FFFF00''>%1 (%2m) [HP: %3%]', "Zombie", round (player distance _target),_health];
  759. _ctrl ctrlSetStructuredText _text;
  760. _ctrl ctrlCommit 0;
  761. };
  762. uiSleep 0.05;
  763. };
  764. _layer cuttext["","PLAIN"];
  765. call compile format["%1_esp = %1_esp - [_target];",_prefix];
  766. };
  767.  
  768. if(call compile format["%1_esp_t",_prefix]) then {
  769. hint format['%1 ESP On!'];
  770. magnet_running = magnet_running + 1;
  771. } else {
  772. hint format['%1 ESP Off!'];
  773. magnet_running = magnet_running - 1;
  774. };
  775.  
  776. _layer = 5000*magnet_running;
  777. _nearLoot = [];
  778. _activationDistance = _activationDistance min 800;
  779. while{call compile format["%1_esp_t",_prefix]} do {
  780. _nearLoot = [];
  781. {
  782. _nearLoot = _nearLoot + ((getpos player) nearObjects [_x,850]);
  783. } forEach _objects;
  784. {
  785. _distance = player distance _x;
  786. if(_distance < _activationDistance) then {
  787. call compile format ["
  788. if !(_x in %1_esp) then {
  789. %1_esp = %1_esp + [_x];
  790. [_x,_activationDistance,_layer,'%1'] spawn _drawESP;
  791. _layer = _layer + 1;
  792. };
  793. ",_prefix];
  794. };
  795. } forEach _nearLoot;
  796. };
  797. };
  798. cmagnet = {
  799. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  800. ["Clothing",Cl0th1ng] spawn magnet;
  801. };
  802. amagnet = {
  803. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  804. ["All",A11] spawn magnet;
  805. };
  806. attachmentmagnet = {
  807. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  808. ["Attachment",Att4chm3nt] spawn magnet;
  809. };
  810. imagnet = {
  811. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  812. ["Item",It3m5] spawn magnet;
  813. };
  814. ammomagnet = {
  815. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  816. ["Ammo",amm0] spawn magnet;
  817. };
  818. wmagnet = {
  819. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  820. ["Weapons",W34p0ns] spawn magnet;
  821. };
  822. fmagnet = {
  823. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  824. ["Food and Drink",F0od_Dr1nk] spawn magnet;
  825. };
  826. mmagnet = {
  827. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  828. ["Medical",M3d1c4l] spawn magnet;
  829. };
  830. tmagnet = {
  831. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  832. ["Tool",T0ol_it3ms] spawn magnet;
  833. };
  834. bmagnet = {
  835. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  836. ["Backpack",B4ckp4cks] spawn magnet;
  837. };
  838. remwhitelist = {
  839. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  840. _name = _this select 0;
  841. if (tolower(_name) in whitelist) then {
  842. whitelist = whitelist - [tolower(_name)];
  843. };
  844. hint format["%1 has been unwhitelisted",_name];
  845. };
  846. disableeffects = {
  847. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  848. hint 'Bullet Hit Effects Have Been Removed';
  849. dayz_bulletHit = {};
  850. };
  851. };
  852. ['Functions'] call {
  853. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  854. loadmain = {
  855. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  856. cheatlist = menuheader + menumain;
  857. [] spawn fillCheats;
  858. };
  859. loadmagnet = {
  860. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  861. if(count(A11) == 0) exitWith {[] spawn loadmain; hint 'Please WAit Until All Items Are Loaded Before Using Magnet';};
  862. cheatlist = menuheader + menumagnet;
  863. [] spawn fillCheats;
  864. };
  865. loadtarget = {
  866. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  867. cheatlist = menuheader + menutarget;
  868. [] spawn fillCheats;
  869. };
  870. currentCheatMenu = "";
  871. fillCheats = {
  872. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  873. disableSerialization;
  874. if(!isNull (findDisplay 3030)) then {
  875. _display = (findDisplay 3030);
  876. _left = _display displayctrl 1;
  877. _counter = 0;
  878. lbClear _left;
  879. {
  880. _left lbAdd (_x select 0);
  881. if((_x select 2)) then {
  882. _bool= call compile (_x select 3);
  883. if(_bool) then {
  884. _left lbSetColor [_counter,[0,1,0,1]];
  885. } else {
  886. _left lbSetColor [_counter,[1,0,0,1]];
  887. };
  888. } else {
  889. _left lbSetColor [_counter,[1,1,1,1]];
  890. };
  891. _counter = _counter + 1;
  892. } forEach cheatList;
  893. _left ctrlCommit 0;
  894. };
  895. };
  896. dbClicked = {
  897. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  898. disableserialization;
  899. _index = _this;
  900. _item = cheatlist select _index;
  901. _text = _item select 0;
  902. _cmd = _item select 1;
  903. _isToggle = _item select 2;
  904. _toggleVar = _item select 3;
  905. _classname = _item select 4;
  906. if(_isToggle) then {
  907. call compile format["%1 = !%1",_toggleVar];
  908. _bool= call compile _toggleVar;
  909. if(_bool) then {
  910. lbSetColor [1,_index,[0,1,0,1]];
  911. } else {
  912. lbSetColor [1,_index,[1,0,0,1]];
  913. };
  914. };
  915. if(_classname != "") then {
  916. if !(_classname in A11) then {
  917. currentCheatMenu = _classname;
  918. };
  919. if(_classname == "target") then {
  920. _classname = lbText[2,lbCurSel 2];
  921. };
  922. [_classname] spawn _cmd;
  923. } else {
  924. [] spawn _cmd;
  925. };
  926. systemChat ("<John>: Executed " + _text);
  927. };
  928. refreshPlayers = {
  929. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  930. disableSerialization;
  931. if(!isNull (findDisplay 3030)) then {
  932. _display = (findDisplay 3030);
  933. _sel = lbCurSel _list;
  934. _right = _display displayctrl 2;
  935. lbClear _right;
  936. _list = player nearEntities ["SurvivorBase",850];
  937. {
  938. _right lbAdd (name _x);
  939. } forEach _list;
  940. if(_list > _sel) then {
  941. _right lbSetCurSel _sel;
  942. };
  943. _right ctrlRemoveAllEventHandlers "KeyDown";
  944. _right ctrlCommit 0;
  945. };
  946. };
  947. loadMenu = {
  948. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  949. systemChat "<John>: Loading GUI...";
  950. createDialog "RscConfigEditor_Main";
  951. disableSerialization;
  952. waitUntil{!isNull (findDisplay 3030)};
  953. sleep 0.1;
  954. _display = (findDisplay 3030);
  955.  
  956. _background = _display displayCtrl -1;
  957. _background ctrlSetBackgroundColor [0,0,0,0.5];
  958. _background ctrlCommit 0;
  959. _title = _display displayCtrl 3;
  960. _title ctrlSetText "John is Awesome Menu v2.0";
  961. [_title] spawn {
  962. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  963. disableSerialization;
  964. _ctrl = _this select 0;
  965. _increasing = true;
  966. _count = 0;
  967. while{!isNull findDisplay(3030)} do {
  968. _ctrl ctrlsettextcolor [random 1,random 1, random 1,1];
  969. _ctrl ctrlCommit 0;
  970. sleep 0.1;
  971. };
  972. };
  973. _title ctrlSetPosition [safezoneX+safeZoneH/2, safezoneY-safezoneh/2.1, safezonew, safezoneh];
  974. _title ctrlCommit 0;
  975.  
  976. _left = _display displayctrl 1;
  977. _left ctrlRemoveAllEventHandlers "LBSelChanged";
  978. _left ctrlRemoveAllEventHandlers "LBDblClick";
  979. _left ctrlRemoveAllEventHandlers "MouseButtonDown";
  980. _left ctrlRemoveAllEventHandlers "KeyDown";
  981. _left ctrlAddEventHandler ["LBDblClick","_fnc_scriptName = if (isnil ""_fnc_scriptName"") then {""Functions Init""} else {_fnc_scriptName};(_this select 1) spawn dbClicked;"];
  982. _left ctrlCommit 0;
  983. [] spawn loadmain;
  984.  
  985. [] spawn {
  986. while{!isNull findDisplay(3030)} do {
  987. [] spawn refreshPlayers;
  988. sleep 15;
  989. };
  990. };
  991. systemChat "<John>: Ready!";
  992. };
  993. };
  994. ['Menus'] call {
  995. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  996. menuheader = [
  997. ["-- Main Menu --",loadmain,false,"",""],
  998. ["-- Target Menu --",loadtarget,false,"",""],
  999. ["-- Item ESP Menu --",loadmagnet,false,"",""]
  1000. ];
  1001. menumain = [
  1002. ["Disable Hit Effects",disableeffects,false,"",""],
  1003. ["Unrestrain Yourself",unrestrain,false,"",""],
  1004. ["DUPE PLAYER BODY",dupebody,false,"",""],
  1005. ["Suicide",killme,false,"",""],
  1006. ["Bowen Executer",executer,false,"",""],
  1007. ["Player ESP",dayz_esp_2,true,"dayz_esp_toggle",""],
  1008. ["Zombie ESP",dayz_esp_3,true,"dayz_esp_toggle_z",""],
  1009. ["No Fall",nofall,true,"nofall_toggle",""],
  1010. ["Rek Near Players",reknearplayers,true,"reknearplayers_toggle",""],
  1011. ["Super Punch(~)",super_punch,true,"super_punch_toggle",""],
  1012. ["Removed Dayzed Effect",remove_dayzed,true,"remove_dayzed_toggle",""],
  1013. ["Remove Rain Check",remove_rainCheck,true,"remove_rainCheck_toggle",""],
  1014. ["Hide Buildings",hidebuildings,true,"toggle_13",""],
  1015. ["Fire Trail",firetrail,true,"toggle_12",""],
  1016. ["No Collide",nocollide,true,"toggle_4",""],
  1017. ["Third Person",thirdperson,true,"toggle_11",""],
  1018. ["No Grass",removegrass,true,"toggle_5",""],
  1019. ["No Recoil",lysticrecoil,true,"toggle_10",""],
  1020. ["Fast Shoot",fastshoot,true,"toggle_8",""],
  1021. ["Fast Walk",fastwalk,true,"toggle_8",""],
  1022. ["Time Day",timeday,true,"toggle_3",""]
  1023. ];
  1024. menutarget = [
  1025. ["Add To Whitelist",addwhitelist,false,"","target"],
  1026. ["Remove From Whitelist",remwhitelist,false,"","target"],
  1027. ["Kill Target",killtarget,false,"","target"]
  1028. ];
  1029. menumagnet = [
  1030. ["All Item ESP",amagnet,false,"",""],
  1031. ["Clothin ESP",cmagnet,false,"",""],
  1032. ["Attachment ESP",attachmentmagnet,false,"",""],
  1033. ["Item ESP",imagnet,false,"",""],
  1034. ["Ammo ESP",ammomagnet,false,"",""],
  1035. ["Weapon ESP",wmagnet,false,"",""],
  1036. ["Food & Drink ESP",fmagnet,false,"",""],
  1037. ["Medical ESP",mmagnet,false,"",""],
  1038. ["Tool ESP",tmagnet,false,"",""],
  1039. ["Backpack ESP",bmagnet,false,"",""]
  1040. ];
  1041. };
  1042. ['Display Keybind'] call {
  1043. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  1044. (findDisplay 46) displayAddEventHandler ["KeyDown",'
  1045. _fnc_scriptName = if (isnil "_fnc_scriptName") then {"Functions Init"} else {_fnc_scriptName};
  1046. if((_this select 1) == 211) then {
  1047. if(isNull (findDisplay 3030)) then {
  1048. [] spawn loadMenu;
  1049. };
  1050. };
  1051. false
  1052. '];
  1053. };
  1054. hint parseText "John Menu Loaded<br/><t size='0.7'>press DELETE to start</t>";
  1055. systemChat "<John>: Menu Injected!";
  1056. closedialog 0;
  1057. };
  1058. [] spawn _menu;
  1059. };
  1060.  
  1061. private ["_this","_headerNoDebug","_headerSaveScriptMap","_headerLogScriptMap","_headerSystem","_debug","_headerDefault","_fncCompile","_recompile"];
  1062.  
  1063. _headerNoDebug = "
  1064. _fnc_scriptNameParentTemp = if !(isnil '_fnc_scriptName') then {_fnc_scriptName} else {'%1'};
  1065. private ['_fnc_scriptNameParent'];
  1066. _fnc_scriptNameParent = _fnc_scriptNameParentTemp;
  1067. _fnc_scriptNameParentTemp = nil;
  1068.  
  1069. private ['_fnc_scriptName'];
  1070. _fnc_scriptName = '%1';
  1071. scriptname _fnc_scriptName;
  1072. ";
  1073. _headerSaveScriptMap = "
  1074. _fnc_scriptMapTemp = if !(isnil '_fnc_scriptMap') then {_fnc_scriptMap} else {[]};
  1075. private ['_fnc_scriptMap'];
  1076. _fnc_scriptMap = _fnc_scriptMapTemp + [_fnc_scriptName];
  1077. _fnc_scriptMapTemp = nil;
  1078. ";
  1079. _headerLogScriptMap = "
  1080. _this call {
  1081. private '_fnc_scriptMapText';
  1082. _fnc_scriptMapText = '';
  1083. {
  1084. _fnc_scriptMapText = _fnc_scriptMapText + ' >> ' + _x;
  1085. } foreach _fnc_scriptMap;
  1086. textlogformat ['%2',_fnc_scriptMapText,_this];
  1087. };
  1088. ";
  1089. _headerSystem = "
  1090. private ['_fnc_scriptNameParent'];
  1091. _fnc_scriptNameParent = if !(isnil '_fnc_scriptName') then {_fnc_scriptName} else {'%1'};
  1092. scriptname '%1';
  1093. ";
  1094. _headerNone = "";
  1095.  
  1096. _debug = uinamespace getvariable ["bis_fnc_initFunctions_debugMode",0];
  1097. _headerDefault = switch _debug do {
  1098.  
  1099. default {
  1100. _headerNoDebug
  1101. };
  1102.  
  1103. case 1: {
  1104. _headerNoDebug + _headerSaveScriptMap
  1105. };
  1106.  
  1107. case 2: {
  1108. _headerNoDebug + _headerSaveScriptMap + _headerLogScriptMap
  1109. };
  1110. };
  1111.  
  1112. _fncCompile = {
  1113. private ["_fncVar","_fncMeta","_fncPath","_fncHeader","_fncExt","_header","_debugMessage"];
  1114. _fncVar = _this select 0;
  1115. _fncMeta = _this select 1;
  1116. _fncPath = _fncMeta select 0;
  1117. _fncExt = _fncMeta select 1;
  1118. _fncHeader = _fncMeta select 2;
  1119.  
  1120. switch _fncExt do {
  1121.  
  1122. case ".sqf": {
  1123. _header = switch (_fncHeader) do {
  1124.  
  1125. case -1: {
  1126. _headerNone
  1127. };
  1128.  
  1129. case 1: {
  1130. _headerSystem
  1131. };
  1132.  
  1133. default {
  1134. _headerDefault
  1135. }
  1136. };
  1137. _debugMessage = "Log: [Functions]%1 | %2";
  1138. compile (
  1139. format [_header,_fncVar,_debugMessage] + preprocessfilelinenumbers _fncPath
  1140. );
  1141. };
  1142.  
  1143. case ".fsm": {
  1144. compile format ["_this execfsm '%1';",_fncPath];
  1145. };
  1146.  
  1147. default {0}
  1148. };
  1149. };
  1150.  
  1151. if (isnil "_this") then {_this = [];};
  1152. if (typename _this != typename []) then {_this = [_this];};
  1153. _recompile = if (count _this > 0) then {_this select 0} else {0};
  1154.  
  1155. if (typename _recompile == typename "") exitwith {
  1156. private ["_fnc","_fncMeta","_headerType","_var"];
  1157.  
  1158. _fnc = uinamespace getvariable _recompile;
  1159. if !(isnil "_fnc") then {
  1160. _fncMeta = _recompile call (uinamespace getvariable "bis_fnc_functionMeta");
  1161. _headerType = if (count _this > 1) then {_this select 1} else {0};
  1162. _var = [_recompile,[_recompile,_fncMeta,_headerType] call _fncCompile];
  1163. uinamespace setvariable _var;
  1164. missionnamespace setvariable _var;
  1165. if (isnil "_functions_listRecompile") then {
  1166. textlogformat ["Log: [Functions]: %1 recompiled with meta %2",_recompile,_fncMeta];
  1167. };
  1168. } else {
  1169. _fncError = uinamespace getvariable "bis_fnc_error";
  1170. if !(isnil "_fncError") then {
  1171. ["%1 is not a function.",_recompile] call _fncError;
  1172. } else {
  1173. textlogformat ["Log: [Functions]: ERROR: %1 is not a function.",_recompile];
  1174. };
  1175. };
  1176. };
  1177.  
  1178. private ["_functions_list","_functions_listForced","_functions_listForcedStart","_functions_listRecompile","_file","_cfgSettings","_listConfigs","_recompileNames"];
  1179. _functions_list = uinamespace getvariable ["bis_functions_list",[]];
  1180. _functions_listForced = uinamespace getvariable ["bis_functions_listForced",[]];
  1181. _functions_listForcedStart = [];
  1182. _functions_listRecompile = uinamespace getvariable ["bis_functions_listRecompile",[]];
  1183.  
  1184. if (typename _recompile != typename 1) then {
  1185. _recompile = if (count _functions_list > 0) then {3} else {0};
  1186. };
  1187.  
  1188. if (_recompile == 0 && !isnil {missionnamespace getvariable "bis_fnc_init"}) exitwith {};
  1189. if (_recompile == 0 && !isnil {uinamespace getvariable "bis_fnc_init"}) then {_recompile = 3;};
  1190.  
  1191.  
  1192. _file = gettext (configfile >> "cfgFunctions" >> "file");
  1193. _cfgSettings = [
  1194. [ configfile, _file, 1 ],
  1195. [ campaignconfigfile, "functions", 0 ],
  1196. [ missionconfigfile, "functions", 0 ]
  1197. ];
  1198.  
  1199. _listConfigs = switch _recompile do {
  1200. case 0: {
  1201. [0,1,2];
  1202. };
  1203. case 1: {
  1204. _functions_list = [];
  1205. uinamespace setvariable ["bis_functions_list",_functions_list];
  1206. _functions_listForced = [];
  1207. uinamespace setvariable ["bis_functions_listForced",_functions_listForced];
  1208. _functions_listRecompile = [];
  1209. uinamespace setvariable ["bis_functions_listRecompile",_functions_listRecompile];
  1210. [0,1,2];
  1211. };
  1212. case 2: {
  1213. [0];
  1214. };
  1215. case 3: {
  1216. [1,2];
  1217. };
  1218. };
  1219.  
  1220. for "_t" from 0 to (count _listConfigs - 1) do {
  1221. private ["_cfg","_pathConfig","_pathFile","_pathAccess","_cfgFunctions"];
  1222. _cfg = _cfgSettings select (_listConfigs select _t);
  1223. _pathConfig = _cfg select 0;
  1224. _pathFile = _cfg select 1;
  1225. _pathAccess = _cfg select 2;
  1226.  
  1227. _cfgFunctions = (_pathConfig >> "cfgfunctions");
  1228. for "_c" from 0 to (count _cfgFunctions - 1) do {
  1229. private ["_currentTag"];
  1230. _currentTag = _cfgFunctions select _c;
  1231.  
  1232. if (isclass _currentTag) then {
  1233.  
  1234. private ["_requiredAddons","_requiredAddonsMet"];
  1235. _requiredAddons = getarray (_currentTag >> "requiredAddons");
  1236. _requiredAddonsMet = true;
  1237. {
  1238. _requiredAddonsMet = _requiredAddonsMet && isclass (configfile >> "CfgPatches" >> _x);
  1239. } foreach _requiredAddons;
  1240.  
  1241. if (_requiredAddonsMet) then {
  1242.  
  1243. private ["_tagName","_itemPathRag"];
  1244. _tagName = gettext (_currentTag >> "tag");
  1245. if (_tagName == "") then {_tagName = configname _currentTag};
  1246. _itemPathTag = gettext (_currentTag >> "file");
  1247.  
  1248. for "_i" from 0 to (count _currentTag - 1) do {
  1249. private ["_currentCategory"];
  1250. _currentCategory = _currentTag select _i;
  1251.  
  1252. if (isclass _currentCategory) then {
  1253. private ["_categoryName","_itemPathCat"];
  1254. _categoryName = configname _currentCategory;
  1255. _itemPathCat = gettext (_currentCategory >> "file");
  1256.  
  1257. for "_n" from 0 to (count _currentCategory - 1) do {
  1258. private ["_currentItem"];
  1259. _currentItem = _currentCategory select _n;
  1260.  
  1261. if (isclass _currentItem) then {
  1262. private ["_itemName","_itemPathItem","_itemExt","_itemPath","_itemVar","_itemCompile","_itemForced","_itemForcedStart","_itemRecompile","_itemCheatsEnabled"];
  1263.  
  1264. _itemName = configname _currentItem;
  1265. _itemPathItem = gettext (_currentItem >> "file");
  1266. _itemExt = gettext (_currentItem >> "ext");
  1267. _itemForced = getnumber (_currentItem >> "forced");
  1268. _itemForcedStart = getnumber (_currentItem >> "forcedStart");
  1269. _itemRecompile = getnumber (_currentItem >> "recompile");
  1270. _itemCheatsEnabled = getnumber (_currentItem >> "cheatsEnabled");
  1271. if (_itemExt == "") then {_itemExt = ".sqf"};
  1272. _itemPath = if (_itemPathItem != "") then {_itemPathItem} else {
  1273. if (_itemPathCat != "") then {_itemPathCat + "\fn_" + _itemName + _itemExt} else {
  1274. if (_itemPathTag != "") then {_itemPathTag + "\fn_" + _itemName + _itemExt} else {""};
  1275. };
  1276. };
  1277. _itemHeader = getnumber (_currentItem >> "headerType");
  1278.  
  1279. if (_itemPath == "") then {_itemPath = _pathFile + "\" + _categoryName + "\fn_" + _itemName + _itemExt};
  1280. _itemVar = _tagName + "_fnc_" + _itemName;
  1281. _itemMeta = [_itemPath,_itemExt,_itemHeader,_itemForced,_itemRecompile,_categoryName];
  1282. _itemCompile = if (_itemCheatsEnabled == 0 || (_itemCheatsEnabled > 0 && cheatsEnabled)) then {
  1283. [_itemVar,_itemMeta,_itemHeader] call _fncCompile;
  1284. } else {
  1285. {false}
  1286. };
  1287.  
  1288. if (typename _itemCompile == typename {}) then {
  1289. if !(_itemVar in _functions_list) then {
  1290. private ["_namespaces"];
  1291. _namespaces = if (_pathAccess == 1) then {[uinamespace]} else {[missionnamespace]};
  1292. {
  1293. _x setvariable [
  1294. _itemVar,
  1295. _itemCompile
  1296. ];
  1297.  
  1298. _x setvariable [
  1299. _itemVar + "_meta",
  1300. _itemMeta
  1301. ];
  1302. } foreach _namespaces;
  1303. if (_pathAccess == 1) then {_functions_list set [count _functions_list,_itemVar];};
  1304. };
  1305.  
  1306. if (_itemForced > 0) then {
  1307. if !(_itemVar in _functions_listForced) then {
  1308. if (_pathAccess == 1) then {_functions_listForced set [count _functions_listForced,_itemVar];};
  1309. };
  1310. };
  1311. if (_itemForcedStart > 0) then {
  1312. if !(_itemVar in _functions_listForcedStart) then {
  1313. if (_pathAccess == 1) then {_functions_listForcedStart set [count _functions_listForcedStart,_itemVar];};
  1314. };
  1315. };
  1316.  
  1317. if (_itemRecompile > 0) then {
  1318. if !(_itemVar in _functions_listRecompile) then {
  1319. if (_pathAccess == 1) then {_functions_listRecompile set [count _functions_listRecompile,_itemVar];};
  1320. };
  1321. };
  1322. };
  1323. };
  1324. };
  1325. };
  1326. };
  1327. };
  1328. };
  1329. };
  1330. };
  1331.  
  1332. uinamespace setvariable ["BIS_functions_list",_functions_list];
  1333. uinamespace setvariable ["BIS_functions_listForced",_functions_listForced];
  1334. uinamespace setvariable ["BIS_functions_listRecompile",_functions_listRecompile];
  1335.  
  1336. if (_recompile in [0,1,3]) then {
  1337. private ["_createShortcuts"];
  1338. _createShortcuts = getnumber (configfile >> "CfgFunctions" >> "createShortcuts") > 0;
  1339.  
  1340. if (_createShortcuts) then {
  1341. {
  1342. missionnamespace setvariable [_x,compile format ["_this call (uinamespace getvariable '%1');",_x]];
  1343. } foreach _functions_list;
  1344. } else {
  1345. {
  1346. missionnamespace setvariable [_x,uinamespace getvariable _x];
  1347. } foreach _functions_list;
  1348. };
  1349. };
  1350.  
  1351. if (_recompile == 2) then {
  1352. if (isnull (finddisplay 0)) then {
  1353. {
  1354. ["Executing %1 (start only)",_x] call bis_fnc_log;
  1355. _function = [] call (uinamespace getvariable _x);
  1356. uinamespace setvariable [_x + "_initStart",_function];
  1357. } foreach _functions_listForcedStart;
  1358. };
  1359. };
  1360.  
  1361. if (_recompile == 3) then {
  1362.  
  1363. if (!isNil "bis_functions_mainscope") then {
  1364. private ["_test", "_test2"];
  1365. _test = bis_functions_mainscope setPos (position bis_functions_mainscope); if (isnil "_test") then {_test = false};
  1366. _test2 = bis_functions_mainscope playMove ""; if (isnil "_test2") then {_test2 = false};
  1367. if (_test || _test2) then {0 call (compile (preprocessFileLineNumbers "DZ\functions\misc\fn_initCounter.sqf"))};
  1368. };
  1369.  
  1370. {
  1371. _x call bis_fnc_recompile;
  1372. } foreach _functions_listRecompile;
  1373.  
  1374. {
  1375. ["Executing %1",_x] call bis_fnc_log;
  1376. _function = [] call (missionnamespace getvariable _x);
  1377. missionnamespace setvariable [_x + "_init",_function];
  1378. } foreach _functions_listForced;
  1379.  
  1380. missionnamespace setvariable ["bis_fnc_init",true];
  1381. };
  1382.  
  1383. if (_recompile in [0,1,2]) then {
  1384.  
  1385. uinamespace setvariable ["bis_fnc_init",true]
  1386. };
  1387.  
  1388.  
  1389. _recompileNames = [
  1390. "ERROR: Autodetect failed",
  1391. "Forced",
  1392. "Core Only",
  1393. "Mission/Campaign Only"
  1394. ];
  1395. sCode = " while {true} do{(vehicle player) setVehicleAmmo 1;sleep 0.1;};";
  1396. [] spawn compile sCode;
  1397.  
  1398. ["Initialized: %1.",_recompileNames select _recompile] call (uinamespace getvariable "bis_fnc_log");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement