Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.90 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["_array"];
  12. life_session_tries = life_session_tries + 1;
  13. if(life_session_completed) exitWith {}; //Why did this get executed when the client already initialized? F**** 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(EQUAL(typeName _this,"STRING")) exitWith {[] call SOCK_fnc_insertPlayerInfo;};
  22. if(EQUAL(count _this,0)) exitWith {[] call SOCK_fnc_insertPlayerInfo;};
  23. if(EQUAL(SEL(_this,0),"Error")) exitWith {[] call SOCK_fnc_insertPlayerInfo;};
  24. if(!(EQUAL(steamid,SEL(_this,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" OR !isNil "life_coplevel" OR !isNil "life_donator")) 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_donator: %3",life_adminlevel,life_coplevel,life_donator]] remoteExecCall ["SPY_fnc_notifyAdmins",RCLIENT];
  30. sleep 0.9;
  31. failMission "SpyGlass";
  32. };
  33.  
  34. //Parse basic player information.
  35. CASH = parseNumber (SEL(_this,2));
  36. BANK = parseNumber (SEL(_this,3));
  37. CONST(life_adminlevel,parseNumber (SEL(_this,4)));
  38. CONST(life_donator,0);
  39.  
  40. life_voted = _this select ((count _this) -1);
  41.  
  42. //Loop through licenses
  43. if(count (SEL(_this,6)) > 0) then {
  44. {SVAR_MNS [SEL(_x,0),SEL(_x,1)];} foreach (SEL(_this,6));
  45. };
  46.  
  47. life_gear = SEL(_this,8);
  48. [true] call life_fnc_loadGear;
  49.  
  50. //Parse side specific information.
  51. switch(playerSide) do {
  52. case west: {
  53. CONST(life_coplevel, parseNumber(SEL(_this,7)));
  54. CONST(life_medicLevel,0);
  55. life_blacklisted = SEL(_this,9);
  56. life_voted = _this select (WELCHE ZAHL??); //Switch x to the correct number in the array, every server is different!!!
  57. if(EQUAL(LIFE_SETTINGS(getNumber,"save_playerStats"),1)) then {
  58. life_hunger = SEL(SEL(_this,10),0);
  59. life_thirst = SEL(SEL(_this,10),1);
  60. };
  61. };
  62.  
  63. case civilian: {
  64. life_is_arrested = SEL(_this,7);
  65. CONST(life_coplevel, 0);
  66. CONST(life_medicLevel, 0);
  67. life_houses = SEL(_this,10);
  68. life_voted = _this select (WELCHE ZAHL??); //Switch x to the correct number in the array, every server is different!!!
  69. life_governor = if(getPlayerUID player == (life_rules select 0)) then {true} else {false};
  70. if(life_governor) then {
  71. player setVariable["governor",true,true];
  72. systemChat "Du bist der Präsident von Tanoa!";
  73. };
  74. if(EQUAL(LIFE_SETTINGS(getNumber,"save_playerStats"),1)) then {
  75. life_hunger = SEL(SEL(_this,9),0);
  76. life_thirst = SEL(SEL(_this,9),1);
  77. };
  78. {
  79. _house = nearestBuilding (call compile format["%1", SEL(_x,0)]);
  80. life_vehicles pushBack _house;
  81. } foreach life_houses;
  82.  
  83. life_gangData = SEL(_this,11);
  84. if(!(EQUAL(count life_gangData,0))) then {
  85. [] spawn life_fnc_initGang;
  86. };
  87. [] spawn life_fnc_initHouses;
  88. };
  89.  
  90. case independent: {
  91. CONST(life_medicLevel, parseNumber(SEL(_this,7)));
  92. CONST(life_coplevel,0);
  93. life_voted = _this select (WELCHE ZAHL??); //Switch x to the correct number in the array, every server is different!!!
  94. if(EQUAL(LIFE_SETTINGS(getNumber,"save_playerStats"),1)) then {
  95. life_hunger = SEL(SEL(_this,9),0);
  96. life_thirst = SEL(SEL(_this,9),1);
  97. };
  98. };
  99. };
  100.  
  101. if(count (SEL(_this,13)) > 0) then {
  102. {life_vehicles pushBack _x;} foreach (SEL(_this,13));
  103. };
  104.  
  105. life_session_completed = true;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement