Advertisement
Guest User

Untitled

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