Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.47 KB | None | 0 0
  1. #include "..\..\script_macros.hpp"
  2. /*
  3. File: fn_onPlayerKilled.sqf
  4. Author: Bryan "Tonic" Boardwine
  5. Description:
  6. When the player dies collect various information about that player
  7. and pull up the death dialog / camera functionality.
  8. */
  9. params [
  10. ["_unit",objNull,[objNull]],
  11. ["_killer",objNull,[objNull]]
  12. ];
  13. disableSerialization;
  14.  
  15. if !((vehicle _unit) isEqualTo _unit) then {
  16. UnAssignVehicle _unit;
  17. _unit action ["getOut", vehicle _unit];
  18. _unit setPosATL [(getPosATL _unit select 0) + 3, (getPosATL _unit select 1) + 1, 0];
  19. };
  20.  
  21. //Set some vars
  22. _unit setVariable ["Revive",true,true];
  23. _unit setVariable ["name",profileName,true]; //Set my name so they can say my name.
  24. _unit setVariable ["restrained",false,true];
  25. _unit setVariable ["Escorting",false,true];
  26. _unit setVariable ["transporting",false,true];
  27. _unit setVariable ["playerSurrender",false,true];
  28. _unit setVariable ["steam64id",(getPlayerUID player),true]; //Set the UID.
  29. _unit setVariable ["FAR_isStabilized",1,true];
  30. _unit setVariable ["brokenBone", false, true];
  31. _unit setVariable ["bloodrate", true, true];
  32. _unit setVariable ["FAR_isUnconscious", 0, true];
  33. //close the esc dialog
  34. if (dialog) then {
  35. closeDialog 0;
  36. };
  37.  
  38. //Setup our camera view
  39. life_deathCamera = "CAMERA" camCreate (getPosATL _unit);
  40. showCinemaBorder true;
  41. life_deathCamera cameraEffect ["Internal","Back"];
  42. createDialog "DeathScreen";
  43. life_deathCamera camSetTarget _unit;
  44. life_deathCamera camSetRelPos [0,3.5,4.5];
  45. life_deathCamera camSetFOV .5;
  46. life_deathCamera camSetFocus [50,0];
  47. life_deathCamera camCommit 0;
  48.  
  49. (findDisplay 7300) displaySetEventHandler ["KeyDown","if ((_this select 1) isEqualTo 1) then {true}"]; //Block the ESC menu
  50.  
  51. //Create a thread for something?
  52. _unit spawn {
  53. private ["_maxTime","_RespawnBtn","_Timer"];
  54. disableSerialization;
  55. _RespawnBtn = ((findDisplay 7300) displayCtrl 7302);
  56. _Timer = ((findDisplay 7300) displayCtrl 7301);
  57. if (LIFE_SETTINGS(getNumber,"respawn_timer") < 5) then {
  58. _maxTime = time + 5;
  59. } else {
  60. _maxTime = time + LIFE_SETTINGS(getNumber,"respawn_timer");
  61. };
  62. _RespawnBtn ctrlEnable false;
  63. waitUntil {_Timer ctrlSetText format [localize "STR_Medic_Respawn",[(_maxTime - time),"MM:SS"] call BIS_fnc_secondsToString];
  64. round(_maxTime - time) <= 0 || isNull _this};
  65. _RespawnBtn ctrlEnable true;
  66. _Timer ctrlSetText localize "STR_Medic_Respawn_2";
  67. };
  68.  
  69. _unit spawn {
  70. private ["_requestBtn","_requestTime"];
  71. disableSerialization;
  72. _requestBtn = ((findDisplay 7300) displayCtrl 7303);
  73. _requestBtn ctrlEnable false;
  74. _requestTime = time + 5;
  75. waitUntil {round(_requestTime - time) <= 0 || isNull _this};
  76. _requestBtn ctrlEnable true;
  77. };
  78.  
  79. [] spawn life_fnc_deathScreen;
  80.  
  81. //Create a thread to follow with some what precision view of the corpse.
  82. [_unit] spawn {
  83. private ["_unit"];
  84. _unit = _this select 0;
  85. waitUntil {if (speed _unit isEqualTo 0) exitWith {true}; life_deathCamera camSetTarget _unit; life_deathCamera camSetRelPos [0,3.5,4.5]; life_deathCamera camCommit 0;};
  86. };
  87.  
  88. //Make the killer wanted
  89. if (!isNull _killer && {!(_killer isEqualTo _unit)} && {!(side _killer isEqualTo west)} && {alive _killer}) then {
  90. if (vehicle _killer isKindOf "LandVehicle") then {
  91. if (life_HC_isActive) then {
  92. [getPlayerUID _killer,_killer getVariable ["realname",name _killer],"187V"] remoteExecCall ["HC_fnc_wantedAdd",HC_Life];
  93. } else {
  94. [getPlayerUID _killer,_killer getVariable ["realname",name _killer],"187V"] remoteExecCall ["life_fnc_wantedAdd",RSERV];
  95. };
  96.  
  97. //Get rid of this if you don't want automatic vehicle license removal.
  98. if (!local _killer) then {
  99. [2] remoteExecCall ["life_fnc_removeLicenses",_killer];
  100. };
  101. } else {
  102. if (life_HC_isActive) then {
  103. [getPlayerUID _killer,_killer getVariable ["realname",name _killer],"187"] remoteExecCall ["HC_fnc_wantedAdd",HC_Life];
  104. } else {
  105. [getPlayerUID _killer,_killer getVariable ["realname",name _killer],"187"] remoteExecCall ["life_fnc_wantedAdd",RSERV];
  106. };
  107.  
  108. if (!local _killer) then {
  109. [3] remoteExecCall ["life_fnc_removeLicenses",_killer];
  110. };
  111. };
  112. };
  113.  
  114. life_save_gear = [player] call life_fnc_fetchDeadGear;
  115.  
  116. if (LIFE_SETTINGS(getNumber,"drop_weapons_onDeath") isEqualTo 0) then {
  117. _unit removeWeapon (primaryWeapon _unit);
  118. _unit removeWeapon (handgunWeapon _unit);
  119. _unit removeWeapon (secondaryWeapon _unit);
  120. };
  121.  
  122. //Killed by cop stuff...
  123. if (side _killer isEqualTo west && !(playerSide isEqualTo west)) then {
  124. life_copRecieve = _killer;
  125. //Did I rob the federal reserve?
  126. if (!life_use_atm && {CASH > 0}) then {
  127. [format [localize "STR_Cop_RobberDead",[CASH] call life_fnc_numberText]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
  128. CASH = 0;
  129. };
  130. };
  131.  
  132. if (!isNull _killer && {!(_killer isEqualTo _unit)}) then {
  133. life_removeWanted = true;
  134. };
  135.  
  136. [_unit] call life_fnc_dropItems;
  137.  
  138. life_action_inUse = false;
  139. life_hunger = 100;
  140. life_thirst = 100;
  141. life_carryWeight = 0;
  142. CASH = 0;
  143. life_is_alive = false;
  144.  
  145. [] call life_fnc_hudUpdate; //Get our HUD updated.
  146. [player,life_settings_enableSidechannel,playerSide] remoteExecCall ["TON_fnc_manageSC",RSERV];
  147.  
  148. [0] call SOCK_fnc_updatePartial;
  149. [3] call SOCK_fnc_updatePartial;
  150. if (playerSide isEqualTo civilian) then {
  151. [4] call SOCK_fnc_updatePartial;
  152. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement