Advertisement
Guest User

Untitled

a guest
Jan 1st, 2019
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.45 KB | None | 0 0
  1. #include "..\script_macros.hpp"
  2. /*
  3. File: init.sqf
  4. Author: Bryan "Tonic" Boardwine
  5.  
  6. Description:
  7. Master client initialization file
  8. */
  9.  
  10. private ["_handle","_timeStamp","_extDB_notLoaded"];
  11. life_firstSpawn = true;
  12. life_session_completed = false;
  13. 0 cutText[localize "STR_Init_ClientSetup","BLACK FADED"];
  14. 0 cutFadeOut 9999999;
  15. _timeStamp = diag_tickTime;
  16. _extDB_notLoaded = "";
  17. diag_log "----------------------------------------------------------------------------------------------------";
  18. diag_log "--------------------------------- Starting Altis Life Client Init ----------------------------------";
  19. diag_log "------------------------------------------ Version 5.0.0 -------------------------------------------";
  20. diag_log "----------------------------------------------------------------------------------------------------";
  21. waitUntil {!isNull player && player == player}; //Wait till the player is ready
  22. [] call compile preprocessFileLineNumbers "core\clientValidator.sqf";
  23. enableSentences false;
  24.  
  25. //Setup initial client core functions
  26. diag_log "::Life Client:: Initialization Variables";
  27. [] call compile preprocessFileLineNumbers "core\configuration.sqf";
  28.  
  29. diag_log "::Life Client:: Variables initialized";
  30. diag_log "::Life Client:: Setting up Eventhandlers";
  31. [] call life_fnc_setupEVH;
  32.  
  33. diag_log "::Life Client:: Eventhandlers completed";
  34. diag_log "::Life Client:: Setting up user actions";
  35. [] call life_fnc_setupActions;
  36.  
  37. diag_log "::Life Client:: User actions completed";
  38. diag_log "::Life Client:: Waiting for server functions to transfer..";
  39. waitUntil {(!isNil "TON_fnc_clientGangLeader")};
  40.  
  41. diag_log "::Life Client:: Received server functions.";
  42. 0 cutText [localize "STR_Init_ServerReady","BLACK FADED"];
  43. 0 cutFadeOut 99999999;
  44.  
  45. diag_log "::Life Client:: Waiting for the server to be ready..";
  46. waitUntil {!isNil "life_server_isReady"};
  47. waitUntil {!isNil "life_HC_isActive" && {!isNil "life_server_extDB_notLoaded"}};
  48.  
  49. if (life_server_extDB_notLoaded) exitWith {
  50. 999999 cutText [localize "STR_Init_ExtdbFail","BLACK FADED"];
  51. 999999 cutFadeOut 99999999;
  52. };
  53.  
  54. waitUntil {life_server_isReady};
  55. [] call SOCK_fnc_dataQuery;
  56. waitUntil {life_session_completed};
  57. 0 cutText[localize "STR_Init_ClientFinish","BLACK FADED"];
  58. 0 cutFadeOut 9999999;
  59.  
  60. //diag_log "::Life Client:: Group Base Execution";
  61. [] spawn life_fnc_escInterupt;
  62.  
  63. //Set bank amount for new players
  64. switch (playerSide) do {
  65. case west: {
  66. life_paycheck = LIFE_SETTINGS(getNumber,"paycheck_cop");
  67. };
  68. case civilian: {
  69. life_paycheck = LIFE_SETTINGS(getNumber,"paycheck_civ");
  70. };
  71. case independent: {
  72. life_paycheck = LIFE_SETTINGS(getNumber,"paycheck_med");
  73. };
  74. };
  75.  
  76. switch (playerSide) do {
  77. case west: {
  78. _handle = [] spawn life_fnc_initCop;
  79. waitUntil {scriptDone _handle};
  80. };
  81. case civilian: {
  82. //Initialize Civilian Settings
  83. _handle = [] spawn life_fnc_initCiv;
  84. waitUntil {scriptDone _handle};
  85. };
  86. case independent: {
  87. //Initialize Medics and blah
  88. _handle = [] spawn life_fnc_initMedic;
  89. waitUntil {scriptDone _handle};
  90. };
  91. };
  92.  
  93. player setVariable ["restrained",false,true];
  94. player setVariable ["Escorting",false,true];
  95. player setVariable ["transporting",false,true];
  96. player setVariable ["playerSurrender",false,true];
  97.  
  98. diag_log "Past Settings Init";
  99. [] execFSM "core\fsm\client.fsm";
  100.  
  101. diag_log "Executing client.fsm";
  102. waitUntil {!(isNull (findDisplay 46))};
  103.  
  104. diag_log "Display 46 Found";
  105. (findDisplay 46) displayAddEventHandler ["KeyDown", "_this call life_fnc_keyHandler"];
  106.  
  107. [player,life_settings_enableSidechannel,playerSide] remoteExecCall ["TON_fnc_manageSC",RSERV];
  108. 0 cutText ["","BLACK IN"];
  109. [] call life_fnc_hudSetup;
  110.  
  111. /* Set up frame-by-frame handlers */
  112. LIFE_ID_PlayerTags = ["LIFE_PlayerTags","onEachFrame","life_fnc_playerTags"] call BIS_fnc_addStackedEventHandler;
  113. LIFE_ID_RevealObjects = ["LIFE_RevealObjects","onEachFrame","life_fnc_revealObjects"] call BIS_fnc_addStackedEventHandler;
  114.  
  115. player setVariable ["steam64ID",getPlayerUID player];
  116. player setVariable ["realname",profileName,true];
  117.  
  118. life_fnc_moveIn = compileFinal
  119. "
  120. life_disable_getIn = false;
  121. player moveInCargo (_this select 0);
  122. life_disable_getOut = true;
  123. ";
  124.  
  125. life_fnc_RequestClientId = player;
  126. publicVariableServer "life_fnc_RequestClientId"; //Variable OwnerID for HeadlessClient
  127.  
  128. [] spawn life_fnc_survival;
  129.  
  130. [] spawn {
  131. for "_i" from 0 to 1 step 0 do {
  132. waitUntil {(!isNull (findDisplay 49)) && {(!isNull (findDisplay 602))}}; // Check if Inventory and ESC dialogs are open
  133. (findDisplay 49) closeDisplay 2; // Close ESC dialog
  134. (findDisplay 602) closeDisplay 2; // Close Inventory dialog
  135. };
  136. };
  137.  
  138. CONSTVAR(life_paycheck); //Make the paycheck static.
  139. if (LIFE_SETTINGS(getNumber,"enable_fatigue") isEqualTo 0) then {player enableFatigue false;};
  140.  
  141. if (LIFE_SETTINGS(getNumber,"pump_service") isEqualTo 1) then {
  142. [] execVM "core\fn_setupStationService.sqf";
  143. };
  144.  
  145. /*
  146. https://feedback.bistudio.com/T117205 - disableChannels settings cease to work when leaving/rejoining mission
  147. Universal workaround for usage in a preInit function. - AgentRev
  148. Remove if Bohemia actually fixes the issue.
  149. */
  150. {
  151. _x params [["_chan",-1,[0]], ["_noText","false",[""]], ["_noVoice","false",[""]]];
  152.  
  153. _noText = [false,true] select ((["false","true"] find toLower _noText) max 0);
  154. _noVoice = [false,true] select ((["false","true"] find toLower _noVoice) max 0);
  155.  
  156. _chan enableChannel [!_noText, !_noVoice];
  157.  
  158. } forEach getArray (missionConfigFile >> "disableChannels");
  159.  
  160. if (life_HC_isActive) then {
  161. [getPlayerUID player,player getVariable ["realname",name player]] remoteExec ["HC_fnc_wantedProfUpdate",HC_Life];
  162. } else {
  163. [getPlayerUID player,player getVariable ["realname",name player]] remoteExec ["life_fnc_wantedProfUpdate",RSERV];
  164. };
  165.  
  166. life_hideoutBuildings = [];
  167. {
  168. private _building = nearestBuilding getMarkerPos _x;
  169. life_hideoutBuildings pushBack _building;
  170. false
  171. } count ["gang_area_1","gang_area_2","gang_area_3"];
  172.  
  173. diag_log "----------------------------------------------------------------------------------------------------";
  174. diag_log format [" End of Altis Life Client Init :: Total Execution Time %1 seconds ",(diag_tickTime) - _timeStamp];
  175. diag_log "----------------------------------------------------------------------------------------------------";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement