Advertisement
Guest User

Untitled

a guest
May 11th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.67 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. //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.
  27. if (!isServer && (!isNil "life_adminlevel" || !isNil "life_coplevel" || !isNil "life_donorlevel")) exitWith {
  28. [profileName,getPlayerUID player,"VariablesAlreadySet"] remoteExecCall ["SPY_fnc_cookieJar",RSERV];
  29. [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];
  30. sleep 0.9;
  31. failMission "SpyGlass";
  32. };
  33.  
  34. //Parse basic player information.
  35. CASH = parseNumber (_this select 2);
  36. BANK = parseNumber (_this select 3);
  37. CONST(life_adminlevel,(_this select 4));
  38. if (LIFE_SETTINGS(getNumber,"donor_level") isEqualTo 1) then {
  39. CONST(life_donorlevel,(_this select 5));
  40. } else {
  41. CONST(life_donorlevel,0);
  42. };
  43.  
  44. //Loop through licenses
  45. if (count (_this select 6) > 0) then {
  46. {missionNamespace setVariable [(_x select 0),(_x select 1)];} forEach (_this select 6);
  47. };
  48.  
  49. //Parse side specific information.
  50. switch (playerSide) do {
  51. case west: {
  52. CONST(life_coplevel,(_this select 7));
  53. CONST(life_municipallevel,(_this select 13));
  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_is_alive = _this select 10;
  77. life_civ_position = _this select 11;
  78. if (life_is_alive) then {
  79. if !(count life_civ_position isEqualTo 3) then {diag_log format ["[requestReceived] Bad position received. Data: %1",life_civ_position];life_is_alive =false;};
  80. if (life_civ_position distance (getMarkerPos "respawn_civilian") < 300) then {life_is_alive = false;};
  81. };
  82. };
  83.  
  84. {
  85. _house = nearestObject [(call compile format ["%1",(_x select 0)]), "House"];
  86. life_vehicles pushBack _house;
  87. } forEach life_houses;
  88.  
  89. life_gangData = _this select (_count - 2);
  90. if !(count life_gangData isEqualTo 0) then {
  91. [] spawn life_fnc_initGang;
  92. };
  93. [] spawn life_fnc_initHouses;
  94. };
  95.  
  96. case independent: {
  97. CONST(life_medicLevel,(_this select 7));
  98. CONST(life_coplevel,0);
  99. if (LIFE_SETTINGS(getNumber,"save_playerStats") isEqualTo 1) then {
  100. life_hunger = ((_this select 9) select 0);
  101. life_thirst = ((_this select 9) select 1);
  102. player setDamage ((_this select 9) select 2);
  103. };
  104. };
  105. };
  106.  
  107. life_gear = _this select 8;
  108. [true] call life_fnc_loadGear;
  109.  
  110. if (count (_this select (_count - 1)) > 0) then {
  111. {life_vehicles pushBack _x;} forEach (_this select (_count - 1));
  112. };
  113.  
  114. life_session_completed = true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement