friquentin

Untitled

Jun 20th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.31 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. _TFenabled = [] call TFAR_fnc_isTeamSpeakPluginEnabled;
  10.  
  11. if (!(_TFenabled)) then {
  12.  
  13. while {!([] call TFAR_fnc_isTeamSpeakPluginEnabled)} do {
  14.  
  15. titleText ["Merci de rejoindre le TS : 54.37.126.167:9865", "BLACK FADED"];
  16. if (player getvariable "taskfr") then {
  17. player setvariable ["taskfr",false,true];
  18. };
  19. };
  20. };
  21.  
  22. */
  23.  
  24.  
  25. /// Début TaskForceRadio
  26. if (isNil "TFAR_fnc_isTeamSpeakPluginEnabled") exitwith {
  27.  
  28. 999999 cutText ["Merci de rejoindre le TS : 54.37.126.167:9865r","BLACK FADED"];
  29. 999999 cutFadeOut 99999999;
  30. if (player getvariable "taskfr") then {
  31. player setvariable ["taskfr",false,true];
  32. };
  33. };
  34.  
  35.  
  36.  
  37. _TFenabled = [] call TFAR_fnc_isTeamSpeakPluginEnabled;
  38.  
  39. if (!(_TFenabled)) then {
  40.  
  41. while {!([] call TFAR_fnc_isTeamSpeakPluginEnabled)} do {
  42.  
  43. titleText ["Merci de rejoindre le TS : 54.37.126.167:9865", "BLACK FADED"];
  44. if (player getvariable "taskfr") then {
  45. player setvariable ["taskfr",false,true];
  46. };
  47. };
  48. };
  49.  
  50. Dvid_TFEnabled = true;
  51. Dvid_onTsServer = "Free Life - Malden - Arma 3" == (call TFAR_fnc_getTeamSpeakServerName); ///////////////////////Edit This line (the channel at the top of your TS (where you right click and "Edit Virtual Server"), yes, get the name of that goes here)
  52. Dvid_onChannel = "TaskForceRadio - Malden" == (call TFAR_fnc_getTeamSpeakChannelName);
  53. titleText ["TFR activé.","BLACK IN"];
  54.  
  55. [] spawn {
  56.  
  57. for "_i" from 0 to 1 step 0 do {
  58.  
  59. _isadmin = false;
  60. if (!(isNil "life_adminlevel")) then {
  61. _adminlvl = life_adminlevel call BIS_fnc_parseNumber;
  62.  
  63. if (_adminlvl > 0) then {
  64. _isadmin = true;
  65. };
  66. };
  67.  
  68.  
  69.  
  70. _TFenabled = [] call TFAR_fnc_isTeamSpeakPluginEnabled;
  71. if ((!(_TFenabled)) && (Dvid_TFEnabled)) then {
  72. if (!(_isadmin)) then {
  73. titleText ["Activez votre Task Force Radio, pour pouvoir jouer.", "BLACK FADED"];
  74. Dvid_TFEnabled = false;
  75. };
  76. if (player getvariable "taskfr") then {
  77. player setvariable ["taskfr",false,true];
  78. };
  79. };
  80.  
  81. _onTsServer = "Free Life - Malden - Arma 3" == (call TFAR_fnc_getTeamSpeakServerName); //////////////////////Edit too pls, or dont but it wont work if you dont
  82. if (!(_onTsServer)) then {
  83. if (!(_isadmin)) then {
  84. titleText ["Merci de rejoindre le TS : 54.37.126.167:9865", "BLACK"];
  85. Dvid_onTsServer = false;
  86. };
  87. if (player getvariable "taskfr") then {
  88. player setvariable ["taskfr",false,true];
  89. };
  90. } else {
  91. if (!(Dvid_onTsServer)) then {
  92. if (!(_isadmin)) then {
  93. titleText ["TFR OK. Bienvenue!","BLACK IN"];
  94. Dvid_onTsServer = true;
  95. };
  96. if (!(player getvariable "taskfr")) then {
  97. player setvariable ["taskfr",true,true];
  98. };
  99. };
  100. };
  101.  
  102. _onChannel = "TaskForceRadio - Malden" == (call TFAR_fnc_getTeamSpeakChannelName);
  103. if (!(_onChannel)) then {
  104. if (!(_isadmin)) then {
  105. titleText ["Veuillez recharger le plugin pour rejoindre le canal TFR || Paramètres -> Plugins -> Recharger tout.", "BLACK FADED"];
  106. Dvid_onChannel = false;
  107. };
  108. if (player getvariable "taskfr") then {
  109. player setvariable ["taskfr",false,true];
  110. };
  111. } else {
  112. if (!(Dvid_onChannel)) then {
  113. titleText ["La vérification du chanel TS est terminée. Bienvenue!","BLACK IN"];
  114. Dvid_onChannel = true;
  115. if (!(player getvariable "taskfr")) then {
  116. player setvariable ["taskfr",true,true];
  117. };
  118. };
  119. };
  120.  
  121.  
  122. if ((_TFenabled) && (!(Dvid_TFEnabled))) then {
  123. titleText ["TFR Recharger.","BLACK IN"];
  124. Dvid_TFEnabled = true;
  125. if (!(player getvariable "taskfr")) then {
  126. player setvariable ["taskfr",true,true];
  127. };
  128. };
  129.  
  130. };
  131. };
  132. /// Fin TaskForceRadio
  133.  
  134. private ["_handle","_timeStamp","_extDB_notLoaded"];
  135. life_firstSpawn = true;
  136. life_session_completed = false;
  137. 0 cutText[localize "STR_Init_ClientSetup","BLACK FADED"];
  138. 0 cutFadeOut 9999999;
  139. _timeStamp = diag_tickTime;
  140. _extDB_notLoaded = "";
  141. diag_log "----------------------------------------------------------------------------------------------------";
  142. diag_log "--------------------------------- Starting Altis Life Client Init ----------------------------------";
  143. diag_log "------------------------------------------ Version 5.0.0 -------------------------------------------";
  144. diag_log "----------------------------------------------------------------------------------------------------";
  145. waitUntil {!isNull player && player == player}; //Wait till the player is ready
  146. [] call compile preprocessFileLineNumbers "core\clientValidator.sqf";
  147. enableSentences false;
  148.  
  149. //Setup initial client core functions
  150. diag_log "::Life Client:: Initialization Variables";
  151. [] call compile preprocessFileLineNumbers "core\configuration.sqf";
  152.  
  153. diag_log "::Life Client:: Variables initialized";
  154. diag_log "::Life Client:: Setting up Eventhandlers";
  155. [] call life_fnc_setupEVH;
  156.  
  157. diag_log "::Life Client:: Eventhandlers completed";
  158. diag_log "::Life Client:: Setting up user actions";
  159. [] call life_fnc_setupActions;
  160.  
  161. diag_log "::Life Client:: User actions completed";
  162. diag_log "::Life Client:: Waiting for server functions to transfer..";
  163. waitUntil {(!isNil "TON_fnc_clientGangLeader")};
  164.  
  165. diag_log "::Life Client:: Received server functions.";
  166. 0 cutText [localize "STR_Init_ServerReady","BLACK FADED"];
  167. 0 cutFadeOut 99999999;
  168.  
  169. diag_log "::Life Client:: Waiting for the server to be ready..";
  170. waitUntil {!isNil "life_server_isReady"};
  171. waitUntil {!isNil "life_HC_isActive" && {!isNil "life_server_extDB_notLoaded"}};
  172.  
  173. if (life_server_extDB_notLoaded) exitWith {
  174. 999999 cutText [localize "STR_Init_ExtdbFail","BLACK FADED"];
  175. 999999 cutFadeOut 99999999;
  176. };
  177.  
  178. waitUntil {life_server_isReady};
  179. [] call SOCK_fnc_dataQuery;
  180. waitUntil {life_session_completed};
  181. 0 cutText[localize "STR_Init_ClientFinish","BLACK FADED"];
  182. 0 cutFadeOut 9999999;
  183.  
  184. //diag_log "::Life Client:: Group Base Execution";
  185. [] spawn life_fnc_escInterupt;
  186.  
  187. //Set bank amount for new players
  188. switch (playerSide) do {
  189. case west: {
  190. life_paycheck = LIFE_SETTINGS(getNumber,"paycheck_cop");
  191. };
  192. case civilian: {
  193. life_paycheck = LIFE_SETTINGS(getNumber,"paycheck_civ");
  194. };
  195. case independent: {
  196. life_paycheck = LIFE_SETTINGS(getNumber,"paycheck_med");
  197. };
  198. };
  199.  
  200. switch (playerSide) do {
  201. case west: {
  202. _handle = [] spawn life_fnc_initCop;
  203. waitUntil {scriptDone _handle};
  204. };
  205. case civilian: {
  206. //Initialize Civilian Settings
  207. _handle = [] spawn life_fnc_initCiv;
  208. waitUntil {scriptDone _handle};
  209. };
  210. case independent: {
  211. //Initialize Medics and blah
  212. _handle = [] spawn life_fnc_initMedic;
  213. waitUntil {scriptDone _handle};
  214. };
  215. };
  216.  
  217. player setVariable ["restrained",false,true];
  218. player setVariable ["Escorting",false,true];
  219. player setVariable ["transporting",false,true];
  220. player setVariable ["playerSurrender",false,true];
  221.  
  222. diag_log "Past Settings Init";
  223. [] execFSM "core\fsm\client.fsm";
  224.  
  225. diag_log "Executing client.fsm";
  226. waitUntil {!(isNull (findDisplay 46))};
  227.  
  228. diag_log "Display 46 Found";
  229. (findDisplay 46) displayAddEventHandler ["KeyDown", "_this call life_fnc_keyHandler"];
  230. player addRating 99999999;
  231.  
  232. //[player,life_settings_enableSidechannel,playerSide] remoteExecCall ["TON_fnc_manageSC",RSERV];
  233. 0 cutText ["","BLACK IN"];
  234. [] call life_fnc_hudSetup;
  235.  
  236. /* Set up frame-by-frame handlers */
  237. LIFE_ID_RevealObjects = ["LIFE_RevealObjects","onEachFrame","life_fnc_revealObjects"] call BIS_fnc_addStackedEventHandler;
  238.  
  239. player setVariable ["steam64ID",getPlayerUID player];
  240. player setVariable ["realname",profileName,false];
  241.  
  242. life_fnc_moveIn = compileFinal
  243. "
  244. life_disable_getIn = false;
  245. player moveInCargo (_this select 0);
  246. life_disable_getOut = true;
  247. ";
  248.  
  249. life_fnc_RequestClientId = player;
  250. publicVariableServer "life_fnc_RequestClientId"; //Variable OwnerID for HeadlessClient
  251.  
  252. [] spawn life_fnc_survival;
  253.  
  254. [] spawn {
  255. for "_i" from 0 to 1 step 0 do {
  256. waitUntil {(!isNull (findDisplay 49)) && {(!isNull (findDisplay 602))}}; // Check if Inventory and ESC dialogs are open
  257. (findDisplay 49) closeDisplay 2; // Close ESC dialog
  258. (findDisplay 602) closeDisplay 2; // Close Inventory dialog
  259. };
  260. };
  261.  
  262. CONSTVAR(life_paycheck); //Make the paycheck static.
  263. if (LIFE_SETTINGS(getNumber,"enable_fatigue") isEqualTo 0) then {player enableFatigue false;};
  264.  
  265. if (LIFE_SETTINGS(getNumber,"pump_service") isEqualTo 1) then {
  266. [] execVM "core\fn_setupStationService.sqf";
  267. };
  268.  
  269. /*
  270. https://feedback.bistudio.com/T117205 - disableChannels settings cease to work when leaving/rejoining mission
  271. Universal workaround for usage in a preInit function. - AgentRev
  272. Remove if Bohemia actually fixes the issue.
  273. */
  274. {
  275. _x params [["_chan",-1,[0]], ["_noText","false",[""]], ["_noVoice","false",[""]]];
  276.  
  277. _noText = [false,true] select ((["false","true"] find toLower _noText) max 0);
  278. _noVoice = [false,true] select ((["false","true"] find toLower _noVoice) max 0);
  279.  
  280. _chan enableChannel [!_noText, !_noVoice];
  281.  
  282. } forEach getArray (missionConfigFile >> "disableChannels");
  283.  
  284. if (life_HC_isActive) then {
  285. [getPlayerUID player,player getVariable ["realname",name player]] remoteExec ["HC_fnc_wantedProfUpdate",HC_Life];
  286. } else {
  287. [getPlayerUID player,player getVariable ["realname",name player]] remoteExec ["life_fnc_wantedProfUpdate",RSERV];
  288. };
  289.  
  290. life_hideoutBuildings = [];
  291. {
  292. private _building = nearestBuilding getMarkerPos _x;
  293. life_hideoutBuildings pushBack _building;
  294. false
  295. } count ["gang_area_1","gang_area_2","gang_area_3"];
  296.  
  297. diag_log "----------------------------------------------------------------------------------------------------";
  298. diag_log format [" End of Altis Life Client Init :: Total Execution Time %1 seconds ",(diag_tickTime) - _timeStamp];
  299. diag_log "----------------------------------------------------------------------------------------------------";
  300. [player] remoteExecCall ["max_phone_fnc_cellPhoneRequest",2];
Advertisement
Add Comment
Please, Sign In to add comment