|
1 | | -#include "..\..\script_macros.hpp" |
2 | | -/* |
3 | | - File: fn_requestReceived.sqf |
4 | | - Author: Bryan "Tonic" Boardwine |
5 | | -
|
6 | | - Description: |
7 | | - Called by the server saying that we have a response so let's |
8 | | - sort through the information, validate it and if all valid |
9 | | - set the client up. |
10 | | -*/ |
11 | | - |
12 | | -private _count = count _this; |
13 | | -life_session_tries = life_session_tries + 1; |
14 | | -if (life_session_completed) exitWith {}; //Why did this get executed when the client already initialized? Fucking arma... |
15 | | -if (life_session_tries > 3) exitWith {cutText[localize "STR_Session_Error","BLACK FADED"]; 0 cutFadeOut 999999999;}; |
16 | | - |
17 | | -0 cutText [localize "STR_Session_Received","BLACK FADED"]; |
18 | | -0 cutFadeOut 9999999; |
19 | | - |
20 | | -//Error handling and junk.. |
21 | | -if (isNil "_this") exitWith {[] call SOCK_fnc_insertPlayerInfo;}; |
22 | | -if (_this isEqualType "") exitWith {[] call SOCK_fnc_insertPlayerInfo;}; |
23 | | -if (count _this isEqualTo 0) exitWith {[] call SOCK_fnc_insertPlayerInfo;}; |
24 | | -if ((_this select 0) isEqualTo "Error") exitWith {[] call SOCK_fnc_insertPlayerInfo;}; |
25 | | -if (!(getPlayerUID player isEqualTo (_this select 0))) exitWith {[] call SOCK_fnc_dataQuery;}; |
26 | | - |
27 | | -//Lets make sure some vars are not set before hand.. If they are get rid of them, hopefully the engine purges past variables but meh who cares. |
28 | | -if (!isServer && (!isNil "life_adminlevel" || !isNil "life_coplevel" || !isNil "life_donorlevel")) exitWith { |
29 | | - [profileName,getPlayerUID player,"VariablesAlreadySet"] remoteExecCall ["SPY_fnc_cookieJar",RSERV]; |
30 | | - [profileName,format ["Variables set before client initialization...\nlife_adminlevel: %1\nlife_coplevel: %2\nlife_donorlevel: %3",life_adminlevel,life_coplevel,life_donorlevel]] remoteExecCall ["SPY_fnc_notifyAdmins",RCLIENT]; |
31 | | - sleep 0.9; |
32 | | - failMission "SpyGlass"; |
33 | | -}; |
34 | | - |
35 | | -//Parse basic player information. |
36 | | -CASH = _this select 2; |
37 | | -BANK = _this select 3; |
38 | | -CONST(life_adminlevel,(_this select 4)); |
39 | | -if (LIFE_SETTINGS(getNumber,"donor_level") isEqualTo 1) then { |
40 | | - CONST(life_donorlevel,(_this select 5)); |
41 | | -} else { |
42 | | - CONST(life_donorlevel,0); |
43 | | -}; |
44 | | - |
45 | | -//Loop through licenses |
46 | | -if !((_this select 6) isEqualTo []) then { |
47 | | - {missionNamespace setVariable [(_x select 0),(_x select 1)];} forEach (_this select 6); |
48 | | -}; |
49 | | - |
50 | | -//Parse side specific information. |
51 | | -switch (playerSide) do { |
52 | | - case west: { |
53 | | - CONST(life_coplevel,(_this select 7)); |
54 | | - CONST(life_medicLevel,0); |
55 | | - life_blacklisted = _this select 9; |
56 | | - if (LIFE_SETTINGS(getNumber,"save_playerStats") isEqualTo 1) then { |
57 | | - life_hunger = ((_this select 10) select 0); |
58 | | - life_thirst = ((_this select 10) select 1); |
59 | | - player setDamage ((_this select 10) select 2); |
60 | | - }; |
61 | | - }; |
62 | | - |
63 | | - case civilian: { |
64 | | - life_is_arrested = _this select 7; |
65 | | - CONST(life_coplevel, 0); |
66 | | - CONST(life_medicLevel, 0); |
67 | | - life_houses = _this select (_count - 3); |
68 | | - if (LIFE_SETTINGS(getNumber,"save_playerStats") isEqualTo 1) then { |
69 | | - life_hunger = ((_this select 9) select 0); |
70 | | - life_thirst = ((_this select 9) select 1); |
71 | | - player setDamage ((_this select 9) select 2); |
72 | | - }; |
73 | | - |
74 | | - //Position |
75 | | - if (LIFE_SETTINGS(getNumber,"save_civilian_position") isEqualTo 1) then { |
76 | | - life_civ_position = _this select 10; |
77 | | - if !(life_civ_position isEqualTo []) then { |
78 | | - if (life_civ_position distance (getMarkerPos "respawn_civilian") < 300) then {life_civ_position = []}; |
79 | | - }; |
80 | | - }; |
81 | | - |
82 | | - { |
83 | | - _house = nearestObject [(call compile format ["%1",(_x select 0)]), "House"]; |
84 | | - life_vehicles pushBack _house; |
85 | | - } forEach life_houses; |
86 | | - |
87 | | - life_gangData = _this select (_count - 2); |
88 | | - if !(life_gangData isEqualTo []) then { |
89 | | - [] spawn life_fnc_initGang; |
90 | | - }; |
91 | | - [] spawn life_fnc_initHouses; |
92 | | - }; |
93 | | - |
94 | | - case independent: { |
95 | | - CONST(life_medicLevel,(_this select 7)); |
96 | | - CONST(life_coplevel,0); |
97 | | - if (LIFE_SETTINGS(getNumber,"save_playerStats") isEqualTo 1) then { |
98 | | - life_hunger = ((_this select 9) select 0); |
99 | | - life_thirst = ((_this select 9) select 1); |
100 | | - player setDamage ((_this select 9) select 2); |
101 | | - }; |
102 | | - }; |
103 | | -}; |
104 | | - |
105 | | -life_gear = _this select 8; |
106 | | -[true] call life_fnc_loadGear; |
107 | | - |
108 | | -if !((_this select (_count - 1)) isEqualTo []) then { |
109 | | - {life_vehicles pushBack _x;} forEach (_this select (_count - 1)); |
110 | | -}; |
111 | | - |
112 | | -life_session_completed = true; |
| 1 | +#include "..\..\script_macros.hpp" |
| 2 | +/* |
| 3 | + File: fn_requestReceived.sqf |
| 4 | + Author: Bryan "Tonic" Boardwine |
| 5 | +
|
| 6 | + Description: |
| 7 | + Called by the server saying that we have a response so let's |
| 8 | + sort through the information, validate it and if all valid |
| 9 | + set the client up. |
| 10 | +*/ |
| 11 | + |
| 12 | +private _count = count _this; |
| 13 | +life_session_tries = life_session_tries + 1; |
| 14 | +if (life_session_completed) exitWith {}; //Why did this get executed when the client already initialized? Fucking arma... |
| 15 | +if (life_session_tries > 3) exitWith {cutText[localize "STR_Session_Error","BLACK FADED"]; 0 cutFadeOut 999999999;}; |
| 16 | + |
| 17 | +0 cutText [localize "STR_Session_Received","BLACK FADED"]; |
| 18 | +0 cutFadeOut 9999999; |
| 19 | + |
| 20 | +//Error handling and junk.. |
| 21 | +if (isNil "_this") exitWith {[] call SOCK_fnc_insertPlayerInfo;}; |
| 22 | +if (_this isEqualType "") exitWith {[] call SOCK_fnc_insertPlayerInfo;}; |
| 23 | +if (count _this isEqualTo 0) exitWith {[] call SOCK_fnc_insertPlayerInfo;}; |
| 24 | +if ((_this select 0) isEqualTo "Error") exitWith {[] call SOCK_fnc_insertPlayerInfo;}; |
| 25 | +if (!(getPlayerUID player isEqualTo (_this select 0))) exitWith {[] call SOCK_fnc_dataQuery;}; |
| 26 | + |
| 27 | +//Lets make sure some vars are not set before hand.. If they are get rid of them, hopefully the engine purges past variables but meh who cares. |
| 28 | +if (!isServer && (!isNil "life_adminlevel" || !isNil "life_coplevel" || !isNil "life_donorlevel")) exitWith { |
| 29 | + [profileName,getPlayerUID player,"VariablesAlreadySet"] remoteExecCall ["SPY_fnc_cookieJar",RSERV]; |
| 30 | + [profileName,format ["Variables set before client initialization...\nlife_adminlevel: %1\nlife_coplevel: %2\nlife_donorlevel: %3",life_adminlevel,life_coplevel,life_donorlevel]] remoteExecCall ["SPY_fnc_notifyAdmins",RCLIENT]; |
| 31 | + sleep 0.9; |
| 32 | + failMission "SpyGlass"; |
| 33 | +}; |
| 34 | + |
| 35 | +//Parse basic player information. |
| 36 | +CASH = _this select 2; |
| 37 | +BANK = _this select 3; |
| 38 | +CONST(life_adminlevel,(_this select 4)); |
| 39 | +if (LIFE_SETTINGS(getNumber,"donor_level") isEqualTo 1) then { |
| 40 | + CONST(life_donorlevel,(_this select 5)); |
| 41 | +} else { |
| 42 | + CONST(life_donorlevel,0); |
| 43 | +}; |
| 44 | + |
| 45 | +//Loop through licenses |
| 46 | +if !((_this select 6) isEqualTo []) then { |
| 47 | + {missionNamespace setVariable [(_x select 0),(_x select 1)];} forEach (_this select 6); |
| 48 | +}; |
| 49 | + |
| 50 | +//Parse side specific information. |
| 51 | +switch (playerSide) do { |
| 52 | + case west: { |
| 53 | + CONST(life_coplevel,(_this select 7)); |
| 54 | + CONST(life_medicLevel,0); |
| 55 | + life_blacklisted = _this select 9; |
| 56 | + if (LIFE_SETTINGS(getNumber,"save_playerStats") isEqualTo 1) then { |
| 57 | + life_hunger = ((_this select 10) select 0); |
| 58 | + life_thirst = ((_this select 10) select 1); |
| 59 | + player setDamage ((_this select 10) select 2); |
| 60 | + }; |
| 61 | + }; |
| 62 | + |
| 63 | + case civilian: { |
| 64 | + life_is_arrested = _this select 7; |
| 65 | + CONST(life_coplevel, 0); |
| 66 | + CONST(life_medicLevel, 0); |
| 67 | + life_houses = _this select (_count - 3); |
| 68 | + if (LIFE_SETTINGS(getNumber,"save_playerStats") isEqualTo 1) then { |
| 69 | + life_hunger = ((_this select 9) select 0); |
| 70 | + life_thirst = ((_this select 9) select 1); |
| 71 | + player setDamage ((_this select 9) select 2); |
| 72 | + }; |
| 73 | + |
| 74 | + //Position |
| 75 | + if (LIFE_SETTINGS(getNumber,"save_civilian_position") isEqualTo 1) then { |
| 76 | + life_civ_position = [_this select 10,_this select 11]; |
| 77 | + if !(life_civ_position isEqualTo []) then { |
| 78 | + if (life_civ_position distance (getMarkerPos "respawn_civilian") < 300) then {life_civ_position = []}; |
| 79 | + }; |
| 80 | + }; |
| 81 | + |
| 82 | + { |
| 83 | + _house = nearestObject [(call compile format ["%1",(_x select 0)]), "House"]; |
| 84 | + life_vehicles pushBack _house; |
| 85 | + } forEach life_houses; |
| 86 | + |
| 87 | + life_gangData = _this select (_count - 2); |
| 88 | + if !(life_gangData isEqualTo []) then { |
| 89 | + [] spawn life_fnc_initGang; |
| 90 | + }; |
| 91 | + [] spawn life_fnc_initHouses; |
| 92 | + }; |
| 93 | + |
| 94 | + case independent: { |
| 95 | + CONST(life_medicLevel,(_this select 7)); |
| 96 | + CONST(life_coplevel,0); |
| 97 | + if (LIFE_SETTINGS(getNumber,"save_playerStats") isEqualTo 1) then { |
| 98 | + life_hunger = ((_this select 9) select 0); |
| 99 | + life_thirst = ((_this select 9) select 1); |
| 100 | + player setDamage ((_this select 9) select 2); |
| 101 | + }; |
| 102 | + }; |
| 103 | +}; |
| 104 | + |
| 105 | +life_gear = _this select 8; |
| 106 | +[true] call life_fnc_loadGear; |
| 107 | + |
| 108 | +if !((_this select (_count - 1)) isEqualTo []) then { |
| 109 | + {life_vehicles pushBack _x;} forEach (_this select (_count - 1)); |
| 110 | +}; |
| 111 | + |
| 112 | +life_session_completed = true; |
0 commit comments