SHARE
TWEET

Untitled

a guest Feb 19th, 2019 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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_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.         //idcard
  61.         if((_this select 12) isEqualTo []) then {
  62.             life_side_noidcard = true;
  63.         } else {
  64.             life_idcard_data = _this select 12;
  65.         };
  66.     };
  67.  
  68.     case civilian: {
  69.         life_is_arrested = _this select 7;
  70.         CONST(life_coplevel, 0);
  71.         CONST(life_medicLevel, 0);
  72.         life_houses = _this select (_count - 3);
  73.         if (LIFE_SETTINGS(getNumber,"save_playerStats") isEqualTo 1) then {
  74.             life_hunger = ((_this select 9) select 0);
  75.             life_thirst = ((_this select 9) select 1);
  76.             player setDamage ((_this select 9) select 2);
  77.         };
  78.        
  79.         //idcard
  80.         life_idcard_data = _this select 13;
  81.  
  82.         //Position
  83.         if (LIFE_SETTINGS(getNumber,"save_civilian_position") isEqualTo 1) then {
  84.             life_is_alive = _this select 10;
  85.             life_civ_position = _this select 11;
  86.             if (life_is_alive) then {
  87.                 if !(count life_civ_position isEqualTo 3) then {diag_log format ["[requestReceived] Bad position received. Data: %1",life_civ_position];life_is_alive =false;};
  88.                 if (life_civ_position distance (getMarkerPos "respawn_civilian") < 300) then {life_is_alive = false;};
  89.             };
  90.         };
  91.  
  92.         {
  93.             _house = nearestObject [(call compile format ["%1",(_x select 0)]), "House"];
  94.             life_vehicles pushBack _house;
  95.         } forEach life_houses;
  96.  
  97.         life_gangData = _this select (_count - 2);
  98.         if !(count life_gangData isEqualTo 0) then {
  99.             [] spawn life_fnc_initGang;
  100.         };
  101.         [] spawn life_fnc_initHouses;
  102.     };
  103.  
  104.     case independent: {
  105.         CONST(life_medicLevel,(_this select 7));
  106.         CONST(life_coplevel,0);
  107.         if (LIFE_SETTINGS(getNumber,"save_playerStats") isEqualTo 1) then {
  108.             life_hunger = ((_this select 9) select 0);
  109.             life_thirst = ((_this select 9) select 1);
  110.             player setDamage ((_this select 9) select 2);
  111.         };
  112.         //idcard
  113.         if((_this select 11) isEqualTo []) then {
  114.             life_side_noidcard = true;
  115.         } else {
  116.             life_idcard_data = _this select 11;
  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;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top