Advertisement
MGT

ExileServer_system_network_event_onHandleDisconnect.sqf

MGT
May 30th, 2018
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.86 KB | None | 0 0
  1. /**
  2. * ExileServer_system_network_event_onHandleDisconnect
  3. *
  4. * Exile Mod
  5. * www.exilemod.com
  6. * © 2015 Exile Mod Team
  7. *
  8. * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
  9. * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
  10. */
  11.  
  12. private["_unit", "_id", "_pos", "_newUnitDeaths", "_constructionObject", "_animal", "_sessionID"];
  13. _unit = _this select 0;
  14. _id = _this select 1;
  15. _uid = _this select 2;
  16. _name = _this select 3;
  17. _pos = getPos _unit;
  18. _newUnitDeaths = _unit getVariable ["ExileDeaths", 0];
  19. if !(_uid in ["", "__SERVER__", "__HEADLESS__"]) then
  20. {
  21. _constructionObject = _unit getVariable ["ExileConstructionObject", objNull];
  22. if !(isNull _constructionObject) then
  23. {
  24. deleteVehicle _constructionObject;
  25. };
  26. if (_unit getVariable ["IsPlayingRussianRoulette", false]) then
  27. {
  28. _unit call ExileServer_system_russianRoulette_event_onPlayerDisconnected;
  29. _unit setVariable ["ExileIsDead", false];
  30. };
  31. _animal = missionNamespace getVariable [format ["ExileAnimal%1", _uid], objNull];
  32. if !(isNull _animal) then
  33. {
  34. deleteVehicle _animal;
  35. missionNamespace setVariable [format ["ExileAnimal%1", _uid], nil];
  36. };
  37. format["endAccountSession:%1", _uid] call ExileServer_system_database_query_fireAndForget;
  38. _sessionID = _unit getVariable ["ExileSessionID", ""];
  39. _sessionID call ExileServer_system_session_end;
  40. _unit setVariable ["ExileSessionID", nil];
  41. if !(_unit getVariable ["ExileIsDead", false]) then
  42. {
  43. if (_unit getVariable ["ExileIsHandcuffed", false] || {_unit getVariable ["ExileIsInCombat", false]}) then
  44. {
  45. if((240-(serverTime)/60) <10)then //time in minutes between restarts, 240 = 4 hours, adjust to your restarts
  46. {
  47. //_time = (240-(serverTime)/60);//uncomment this line for infiSTAR logging//time in minutes between restarts, 240 = 4 hours, adjust to your restarts
  48. //_logOutlogNP = format ["(%1) %2 HANDCUFF or COMBAT logged @ %3 with %4 mins left - no punishment", name _unit,_uid,mapGridPosition _pos,_time];//uncomment this line for infiSTAR logging
  49. //["COMBATLOG",_logOutlogNP] call FNC_A3_CUSTOMLOG;//uncomment this line for infiSTAR logging
  50. _unit call ExileServer_object_player_database_update;
  51. deleteVehicle _unit;
  52. _unit = objNull;
  53. }
  54. else
  55. {
  56. _unit setDamage 999;
  57. format["insertPlayerHistory:%1:%2:%3:%4:%5", _uid, _name, _pos select 0, _pos select 1, _pos select 2] call ExileServer_system_database_query_fireAndForget;
  58. format["deletePlayer:%1", _unit getVariable ["ExileDatabaseId", -1]] call ExileServer_system_database_query_fireAndForget;
  59. _unit setVariable ["ExileIsDead", true];
  60. _unit setVariable ["ExileDiedAt", time];
  61. _unit setVariable ["ExileName", _name, true];
  62. _newUnitDeaths = _newUnitDeaths + 1;
  63. _unit setVariable ["ExileDeaths", _newUnitDeaths];
  64. format["addAccountDeath:%1", _uid] call ExileServer_system_database_query_fireAndForget;
  65. _unit call ExileServer_object_player_sendStatsUpdate;
  66. private _message = [
  67. format["HANDCUFF LOGOUT: %1 has been killed", name _unit],
  68. format["COMBAT LOGOUT: %1 has been killed", name _unit]
  69. ] select (_unit getVariable ["ExileIsInCombat", false]);
  70. //_logOutlog = format ["%1 %2", name _unit, _message];//uncomment this line for infiSTAR logging
  71. //["COMBATLOG",_logOutlog] call FNC_A3_CUSTOMLOG;//uncomment this line for infiSTAR logging
  72. ["systemChatRequest", [_message]] call ExileServer_system_network_send_broadcast;
  73. ["toastRequest", ["InfoTitleAndText", ["Logout!", _message]]] call ExileServer_system_network_send_broadcast;
  74. _unit = objNull;
  75. };
  76. }
  77. else
  78. {
  79. _unit call ExileServer_object_player_database_update;
  80. deleteVehicle _unit;
  81. _unit = objNull;
  82. };
  83. };
  84. };
  85. if !(isNull _unit) then
  86. {
  87. [_unit] joinSilent (createGroup independent);
  88. };
  89. false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement