SHOW:
|
|
- or go back to the newest paste.
| 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 | [] call mav_introcam_fnc_startCinematicCam; | |
| 14 | [0, "Setting up client, please wait"] call mav_introcam_fnc_updateCinematicStatus; | |
| 15 | 0 cutFadeOut 9999999; | |
| 16 | _timeStamp = diag_tickTime; | |
| 17 | _extDB_notLoaded = ""; | |
| 18 | diag_log "----------------------------------------------------------------------------------------------------"; | |
| 19 | diag_log "--------------------------------- Starting Altis Life Client Init ----------------------------------"; | |
| 20 | diag_log "------------------------------------------ Version 5.0.0 -------------------------------------------"; | |
| 21 | diag_log "----------------------------------------------------------------------------------------------------"; | |
| 22 | waitUntil {!isNull player && player == player}; //Wait till the player is ready
| |
| 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, "Waiting for server to be ready"] call mav_introcam_fnc_updateCinematicStatus; | |
| 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 | [1, "APPUIE SUR ESPACE POUR PASSER"] call mav_introcam_fnc_updateCinematicStatus; | |
| 58 | waitUntil {mav_introcam_continue};
| |
| 59 | 0 cutFadeOut 9999999; | |
| 60 | ||
| 61 | //diag_log "::Life Client:: Group Base Execution"; | |
| 62 | [] spawn life_fnc_escInterupt; | |
| 63 | ||
| 64 | //Set bank amount for new players | |
| 65 | switch (playerSide) do {
| |
| 66 | case west: {
| |
| 67 | life_paycheck = LIFE_SETTINGS(getNumber,"paycheck_cop"); | |
| 68 | }; | |
| 69 | case civilian: {
| |
| 70 | life_paycheck = LIFE_SETTINGS(getNumber,"paycheck_civ"); | |
| 71 | }; | |
| 72 | case independent: {
| |
| 73 | life_paycheck = LIFE_SETTINGS(getNumber,"paycheck_med"); | |
| 74 | }; | |
| 75 | case east : {
| |
| 76 | life_paycheck = LIFE_SETTINGS(getNumber,"paycheck_adac"); | |
| 77 | }; | |
| 78 | }; | |
| 79 | ||
| 80 | switch (playerSide) do {
| |
| 81 | case west: {
| |
| 82 | _handle = [] spawn life_fnc_initCop; | |
| 83 | waitUntil {scriptDone _handle};
| |
| 84 | }; | |
| 85 | case civilian: {
| |
| 86 | //Initialize Civilian Settings | |
| 87 | _handle = [] spawn life_fnc_initCiv; | |
| 88 | waitUntil {scriptDone _handle};
| |
| 89 | }; | |
| 90 | case independent: {
| |
| 91 | //Initialize Medics and blah | |
| 92 | _handle = [] spawn life_fnc_initMedic; | |
| 93 | waitUntil {scriptDone _handle};
| |
| 94 | }; | |
| 95 | case east : {
| |
| 96 | _handle = [] spawn life_fnc_initAdac; | |
| 97 | waitUntil {scriptDone _handle};
| |
| 98 | }; | |
| 99 | }; | |
| 100 | ||
| 101 | player setVariable ["restrained",false,true]; | |
| 102 | player setVariable ["Escorting",false,true]; | |
| 103 | player setVariable ["transporting",false,true]; | |
| 104 | player setVariable ["playerSurrender",false,true]; | |
| 105 | ||
| 106 | diag_log "Past Settings Init"; | |
| 107 | [] execFSM "core\fsm\client.fsm"; | |
| 108 | ||
| 109 | diag_log "Executing client.fsm"; | |
| 110 | waitUntil {!(isNull (findDisplay 46))};
| |
| 111 | ||
| 112 | diag_log "Display 46 Found"; | |
| 113 | (findDisplay 46) displayAddEventHandler ["KeyDown", "_this call life_fnc_keyHandler"]; | |
| 114 | ||
| 115 | [player,life_settings_enableSidechannel,playerSide] remoteExecCall ["TON_fnc_manageSC",RSERV]; | |
| 116 | 0 cutText ["","BLACK IN"]; | |
| 117 | [] call life_fnc_hudSetup; | |
| 118 | ||
| 119 | /* Set up frame-by-frame handlers */ | |
| 120 | //LIFE_ID_PlayerTags = ["LIFE_PlayerTags","onEachFrame","life_fnc_playerTags"] call BIS_fnc_addStackedEventHandler; | |
| 121 | LIFE_ID_RevealObjects = ["LIFE_RevealObjects","onEachFrame","life_fnc_revealObjects"] call BIS_fnc_addStackedEventHandler; | |
| 122 | ||
| 123 | player setVariable ["steam64ID",getPlayerUID player]; | |
| 124 | player setVariable ["realname",profileName,true]; | |
| 125 | player setVariable ["missingOrgan",false,true];//sets variables to false on start | |
| 126 | player setVariable ["hasOrgan",false,true]; | |
| 127 | ||
| 128 | life_fnc_moveIn = compileFinal | |
| 129 | " | |
| 130 | life_disable_getIn = false; | |
| 131 | player moveInCargo (_this select 0); | |
| 132 | life_disable_getOut = true; | |
| 133 | "; | |
| 134 | ||
| 135 | life_fnc_RequestClientId = player; | |
| 136 | publicVariableServer "life_fnc_RequestClientId"; //Variable OwnerID for HeadlessClient | |
| 137 | ||
| 138 | [] spawn life_fnc_survival; | |
| 139 | ||
| 140 | [] spawn {
| |
| 141 | for "_i" from 0 to 1 step 0 do {
| |
| 142 | waitUntil {(!isNull (findDisplay 49)) && {(!isNull (findDisplay 602))}}; // Check if Inventory and ESC dialogs are open
| |
| 143 | (findDisplay 49) closeDisplay 2; // Close ESC dialog | |
| 144 | (findDisplay 602) closeDisplay 2; // Close Inventory dialog | |
| 145 | }; | |
| 146 | }; | |
| 147 | ||
| 148 | CONSTVAR(life_paycheck); //Make the paycheck static. | |
| 149 | if (LIFE_SETTINGS(getNumber,"enable_fatigue") isEqualTo 0) then {player enableFatigue false;};
| |
| 150 | ||
| 151 | if (LIFE_SETTINGS(getNumber,"pump_service") isEqualTo 1) then {
| |
| 152 | [] execVM "core\fn_setupStationService.sqf"; | |
| 153 | }; | |
| 154 | ||
| 155 | /* | |
| 156 | https://feedback.bistudio.com/T117205 - disableChannels settings cease to work when leaving/rejoining mission | |
| 157 | Universal workaround for usage in a preInit function. - AgentRev | |
| 158 | Remove if Bohemia actually fixes the issue. | |
| 159 | */ | |
| 160 | {
| |
| 161 | _x params [["_chan",-1,[0]], ["_noText","false",[""]], ["_noVoice","false",[""]]]; | |
| 162 | ||
| 163 | _noText = [false,true] select ((["false","true"] find toLower _noText) max 0); | |
| 164 | _noVoice = [false,true] select ((["false","true"] find toLower _noVoice) max 0); | |
| 165 | ||
| 166 | _chan enableChannel [!_noText, !_noVoice]; | |
| 167 | ||
| 168 | } forEach getArray (missionConfigFile >> "disableChannels"); | |
| 169 | ||
| 170 | if (life_HC_isActive) then {
| |
| 171 | [getPlayerUID player,player getVariable ["realname",name player]] remoteExec ["HC_fnc_wantedProfUpdate",HC_Life]; | |
| 172 | } else {
| |
| 173 | [getPlayerUID player,player getVariable ["realname",name player]] remoteExec ["life_fnc_wantedProfUpdate",RSERV]; | |
| 174 | }; | |
| 175 | ||
| 176 | if (life_HC_isActive) then {
| |
| 177 | [getPlayerUID player,player getVariable ["realname",name player]] remoteExec ["HC_fnc_bountyProfUpdate",HC_Life]; | |
| 178 | } else {
| |
| 179 | [getPlayerUID player,player getVariable ["realname",name player]] remoteExec ["life_fnc_bountyProfUpdate",RSERV]; | |
| 180 | }; | |
| 181 | ||
| 182 | life_hideoutBuildings = []; | |
| 183 | {
| |
| 184 | private _building = nearestBuilding getMarkerPos _x; | |
| 185 | life_hideoutBuildings pushBack _building; | |
| 186 | false | |
| 187 | } count ["gang_area_1","gang_area_2","gang_area_3"]; | |
| 188 | ||
| 189 | [] spawn theprogrammer_core_fnc_clientInit; | |
| 190 | ||
| 191 | DYNAMICMARKET_boughtItems = []; | |
| 192 | [player] remoteExec ["TON_fnc_playerLogged",RSERV]; | |
| 193 | ||
| 194 | ||
| 195 | [] spawn {
| |
| 196 | while {true} do {
| |
| 197 | sleep (1 + random 1); | |
| 198 | [] spawn SOCK_fnc_updateRequest; | |
| 199 | }; | |
| 200 | }; | |
| 201 | ||
| 202 | //Hotel des ventes | |
| 203 | waitUntil {!isNil "vAH_loaded"};
| |
| 204 | private["_total","_uid","_toDel"]; | |
| 205 | _total = 0; | |
| 206 | _toDel = []; | |
| 207 | _uid = getPlayerUID player; | |
| 208 | {if ((_x select 5 IsEqualto _uid) && (_x select 7 IsEqualto 2)) then {_total = _total + (_x select 4);_toDel pushBack (_x select 0)};}forEach all_ah_items;
| |
| 209 | ||
| 210 | if (_total > 0) then {
| |
| 211 | {[1,_x] remoteExec ["TON_fnc_vAH_update",false];}forEach _toDel;
| |
| 212 | [0,format["Pendant que vous étiez déconnecté vous avez vendu $%1 à l'hotel des ventes",[_total]call life_fnc_numberText]] remoteExec ["life_fnc_broadcast",player]; | |
| 213 | life_atmcash = life_atmcash + _total; | |
| 214 | }; | |
| 215 | ||
| 216 | [] call life_fnc_cellPhoneCheck; | |
| 217 | ||
| 218 | ||
| 219 | ||
| 220 | diag_log "----------------------------------------------------------------------------------------------------"; | |
| 221 | diag_log format [" End of Altis Life Client Init :: Total Execution Time %1 seconds ",(diag_tickTime) - _timeStamp]; | |
| 222 | diag_log "----------------------------------------------------------------------------------------------------"; |