Advertisement
Guest User

Untitled

a guest
Mar 18th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.75 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) != _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 FALSE;
  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. [] spawn life_fnc_deathScreen;
  64.  
  65. //Create a thread to follow with some what precision view of the corpse.
  66. [_unit] spawn {
  67.     private["_unit"];
  68.     _unit = _this select 0;
  69.     waitUntil {if (speed _unit isEqualTo 0) exitWith {true}; life_deathCamera camSetTarget _unit; life_deathCamera camSetRelPos [0,3.5,4.5]; life_deathCamera camCommit 0;};
  70. };
  71.  
  72. //Make the killer wanted
  73. if (!isNull _killer && {_killer != _unit} && {side _killer != west} && {alive _killer}) then {
  74.     if (vehicle _killer isKindOf "LandVehicle") then {
  75.  
  76.         if (life_HC_isActive) then {
  77.             [getPlayerUID _killer,_killer getVariable ["realname",name _killer],"187V"] remoteExecCall ["HC_fnc_wantedAdd",HC_Life];
  78.         } else {
  79.             [getPlayerUID _killer,_killer getVariable ["realname",name _killer],"187V"] remoteExecCall ["life_fnc_wantedAdd",RSERV];
  80.         };
  81.  
  82.         //Get rid of this if you don't want automatic vehicle license removal.
  83.         if (!local _killer) then {
  84.             [2] remoteExecCall ["life_fnc_removeLicenses",_killer];
  85.         };
  86.     } else {
  87.  
  88.         if (life_HC_isActive) then {
  89.             [getPlayerUID _killer,_killer getVariable ["realname",name _killer],"187"] remoteExecCall ["HC_fnc_wantedAdd",HC_Life];
  90.         } else {
  91.             [getPlayerUID _killer,_killer getVariable ["realname",name _killer],"187"] remoteExecCall ["life_fnc_wantedAdd",RSERV];
  92.         };
  93.  
  94.         if (!local _killer) then {
  95.             [3] remoteExecCall ["life_fnc_removeLicenses",_killer];
  96.         };
  97.     };
  98. };
  99.  
  100. life_save_gear = [player] call life_fnc_fetchDeadGear;
  101.  
  102. _containers = nearestObjects[getPosATL player,["WeaponHolderSimulated"],5];
  103. {deleteVehicle _x;} forEach _containers;
  104.  
  105. //Killed by cop stuff...
  106. if (side _killer isEqualTo west && playerSide != west) then {
  107.     life_copRecieve = _killer;
  108.     //Did I rob the federal reserve?
  109.     if (!life_use_atm && {CASH > 0}) then {
  110.         [format[localize "STR_Cop_RobberDead",[CASH] call life_fnc_numberText]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
  111.         CASH = 0;
  112.     };
  113. };
  114.  
  115. if (!isNull _killer && {_killer != _unit}) then {
  116.     life_removeWanted = true;
  117. };
  118.  
  119. _handle = [_unit] spawn life_fnc_dropItems;
  120. waitUntil {scriptDone _handle};
  121.  
  122. life_hunger = 100;
  123. life_thirst = 100;
  124. life_carryWeight = 0;
  125. CASH = 0;
  126. life_is_alive = false;
  127.  
  128. [] call life_fnc_hudUpdate; //Get our HUD updated.
  129. [player,life_settings_enableSidechannel,playerSide] remoteExecCall ["TON_fnc_managesc",RSERV];
  130.  
  131. [0] call SOCK_fnc_updatePartial;
  132. [3] call SOCK_fnc_updatePartial;
  133. [4] call SOCK_fnc_updatePartial;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement