Advertisement
Guest User

Untitled

a guest
Mar 14th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.98 KB | None | 0 0
  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. private _count = count _this;
  12. life_session_tries = life_session_tries + 1;
  13. if (life_session_completed) exitWith {}; //Why did this get executed when the client already initialized? Fucking arma...
  14. if (life_session_tries > 3) exitWith {cutText[localize "STR_Session_Error","BLACK FADED"]; 0 cutFadeOut 999999999;};
  15.  
  16. 0 cutText [localize "STR_Session_Received","BLACK FADED"];
  17. 0 cutFadeOut 9999999;
  18.  
  19. //Error handling and junk..
  20. if (isNil "_this") exitWith {[] call SOCK_fnc_insertPlayerInfo;};
  21. if (_this isEqualType "") exitWith {[] call SOCK_fnc_insertPlayerInfo;};
  22. if (count _this isEqualTo 0) exitWith {[] call SOCK_fnc_insertPlayerInfo;};
  23. if ((_this select 0) isEqualTo "Error") exitWith {[] call SOCK_fnc_insertPlayerInfo;};
  24. if (!(getPlayerUID player isEqualTo (_this select 0))) exitWith {[] call SOCK_fnc_dataQuery;};
  25.  
  26. //Parse basic player information.
  27. CASH = parseNumber (_this select 2);
  28. BANK = parseNumber (_this select 3);
  29. CONST(life_adminlevel,(_this select 4));
  30. if (LIFE_SETTINGS(getNumber,"donor_level") isEqualTo 1) then {
  31. CONST(life_donorlevel,(_this select 5));
  32. } else {
  33. CONST(life_donorlevel,0);
  34. };
  35.  
  36. _IDent = "null";
  37. if (playerSide in [east,independent]) then {_IDent = 11};
  38. if (playerSide isEqualTo civilian) then {_IDent = 13};
  39. if (playerSide isEqualTo west) then {_IDent = 12};
  40. player setVariable ["realnameREAL",format ["ID:%1",_this select _IDent],true];
  41.  
  42. #define CONST(var1,var2) var1 = compile (if (var2 isEqualType "") then {var2} else {str(var2)})
  43. //Loop through licenses
  44. if (count (_this select 6) > 0) then {
  45. {missionNamespace setVariable [(_x select 0),(_x select 1)];} forEach (_this select 6);
  46. };
  47.  
  48. //Parse side specific information.
  49. switch (playerSide) do {
  50. case west: {
  51. CONST(life_coplevel,(_this select 7));
  52. CONST(life_adacLevel,0);
  53. CONST(life_medicLevel,0);
  54. life_blacklisted = _this select 9;
  55. if (LIFE_SETTINGS(getNumber,"save_playerStats") isEqualTo 1) then {
  56. life_hunger = ((_this select 10) select 0);
  57. life_thirst = ((_this select 10) select 1);
  58. player setDamage ((_this select 10) select 2);
  59. };
  60. };
  61.  
  62. case civilian: {
  63. life_is_arrested = _this select 7;
  64. CONST(life_coplevel, 0);
  65. CONST(life_medicLevel, 0);
  66. life_houses = _this select (_count - 2);
  67. if (LIFE_SETTINGS(getNumber,"save_playerStats") isEqualTo 1) then {
  68. life_hunger = ((_this select 9) select 0);
  69. life_thirst = ((_this select 9) select 1);
  70. player setDamage ((_this select 9) select 2);
  71. };
  72.  
  73. //Position
  74. if (LIFE_SETTINGS(getNumber,"save_civilian_position") isEqualTo 1) then {
  75. life_is_alive = _this select 10;
  76. life_civ_position = _this select 11;
  77. if (life_is_alive) then {
  78. if !(count life_civ_position isEqualTo 3) then {diag_log format ["[requestReceived] Bad position received. Data: %1",life_civ_position];life_is_alive =false;};
  79. if (life_civ_position distance (getMarkerPos "respawn_civilian") < 300) then {life_is_alive = false;};
  80. };
  81. };
  82.  
  83. {
  84. _house = nearestObject [(call compile format ["%1",(_x select 0)]), "House"];
  85. life_vehicles pushBack _house;
  86. } forEach life_houses;
  87.  
  88. life_gangData = [_this select (_count - 4),_this select (_count - 3)];
  89. if(!(life_gangData isEqualTo [-1,-1])) then {
  90. [(life_gangData select 0)] spawn life_fnc_gang_findGang;
  91. } else {
  92. [player] join grpNull;
  93. player setVariable ["gang_init_done",true,true];
  94. };
  95. [] spawn life_fnc_initHouses;
  96. };
  97.  
  98. case independent: {
  99. CONST(life_medicLevel,(_this select 7));
  100. CONST(life_adacLevel,0);
  101. CONST(life_coplevel,0);
  102. if (LIFE_SETTINGS(getNumber,"save_playerStats") isEqualTo 1) then {
  103. life_hunger = ((_this select 9) select 0);
  104. life_thirst = ((_this select 9) select 1);
  105. player setDamage ((_this select 9) select 2);
  106. };
  107. };
  108.  
  109. case east: {
  110. CONST(life_adaclevel, (_this select 7));
  111. CONST(life_medicLevel,0);
  112. CONST(life_coplevel,0);
  113. if (LIFE_SETTINGS(getNumber,"save_playerStats") isEqualTo 1) then {
  114. life_hunger = ((_this select 9) select 0);
  115. life_thirst = ((_this select 9) select 1);
  116. player setDamage ((_this select 9) select 2);
  117. };
  118. };
  119. };
  120.  
  121. life_gear = _this select 8;
  122. [true] call life_fnc_loadGear;
  123.  
  124. if (count (_this select (_count - 1)) > 0) then {
  125. {life_vehicles pushBack _x;} forEach (_this select (_count - 1));
  126. };
  127.  
  128. life_session_completed = true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement