Advertisement
DarkSilencer

Untitled

Jan 23rd, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.01 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.  
  15. disableSerialization;
  16.  
  17. //Set some vars
  18. _unit SVAR ["Revive",FALSE,TRUE]; //Set the corpse to a revivable state.
  19. _unit SVAR ["name",profileName,TRUE]; //Set my name so they can say my name.
  20. _unit SVAR ["restrained",FALSE,TRUE];
  21. _unit SVAR ["Escorting",FALSE,TRUE];
  22. _unit SVAR ["transporting",FALSE,TRUE]; //Why the fuck do I have this? Is it used?
  23. _unit SVAR ["steam64id",(getPlayerUID player),true]; //Set the UID.
  24. _unit enableFatigue false; //Disables Fatigue.
  25.  
  26. //Setup our camera view
  27. life_deathCamera = "CAMERA" camCreate (getPosATL _unit);
  28. showCinemaBorder TRUE;
  29. life_deathCamera cameraEffect ["Internal","Back"];
  30. createDialog "DeathScreen";
  31. life_deathCamera camSetTarget _unit;
  32. life_deathCamera camSetRelPos [0,3.5,4.5];
  33. life_deathCamera camSetFOV .5;
  34. life_deathCamera camSetFocus [50,0];
  35. life_deathCamera camCommit 0;
  36.  
  37. (findDisplay 7300) displaySetEventHandler ["KeyDown","if((_this select 1) == 1) then {true}"]; //Block the ESC menu
  38.  
  39. //Create a thread for something?
  40. _unit spawn {
  41. private["_maxTime","_RespawnBtn","_Timer"];
  42. disableSerialization;
  43. _RespawnBtn = ((findDisplay 7300) displayCtrl 7302);
  44. _Timer = ((findDisplay 7300) displayCtrl 7301);
  45.  
  46. _maxTime = time + (life_respawn_timer * 60);
  47. _RespawnBtn ctrlEnable false;
  48. waitUntil {_Timer ctrlSetText format[localize "STR_Medic_Respawn",[(_maxTime - time),"MM:SS.MS"] call BIS_fnc_secondsToString];
  49. round(_maxTime - time) <= 0 OR isNull _this || Life_request_timer};
  50.  
  51. if (Life_request_timer) then {
  52. _maxTime = time + (life_respawn_timer * 300);
  53. waitUntil {_Timer ctrlSetText format[localize "STR_Medic_Respawn",[(_maxTime - time),"MM:SS.MS"] call BIS_fnc_secondsToString];
  54. round(_maxTime - time) <= 0 || isNull _this};
  55. };
  56. Life_request_timer = false; //resets increased respawn timer
  57.  
  58. _RespawnBtn ctrlEnable true;
  59. _Timer ctrlSetText localize "STR_Medic_Respawn_2";
  60. };
  61.  
  62. [] spawn life_fnc_deathScreen;
  63.  
  64. //Create a thread to follow with some what precision view of the corpse.
  65. [_unit] spawn {
  66. private["_unit"];
  67. _unit = _this select 0;
  68. waitUntil {if(speed _unit == 0) exitWith {true}; life_deathCamera camSetTarget _unit; life_deathCamera camSetRelPos [0,3.5,4.5]; life_deathCamera camCommit 0;};
  69. };
  70.  
  71. //Make the killer wanted
  72. if(!isNull _killer && {_killer != _unit} && {side _killer != west} && {alive _killer}) then {
  73. if(vehicle _killer isKindOf "LandVehicle") then {
  74. [getPlayerUID _killer,_killer GVAR ["realname",name _killer],"187V"] remoteExecCall ["life_fnc_wantedAdd",RSERV];
  75. //Get rid of this if you don't want automatic vehicle license removal.
  76. if(!local _killer) then {
  77. [2] remoteExecCall ["life_fnc_removeLicenses",_killer];
  78. };
  79. } else {
  80. [getPlayerUID _killer,_killer GVAR ["realname",name _killer],"187"] remoteExecCall ["life_fnc_wantedAdd",RSERV];
  81.  
  82. if(!local _killer) then {
  83. [3] remoteExecCall ["life_fnc_removeLicenses",_killer];
  84. };
  85. };
  86. };
  87.  
  88. //Killed by cop stuff...
  89. if(side _killer == west && playerSide != west) then {
  90. life_copRecieve = _killer;
  91. //Did I rob the federal reserve?
  92. if(!life_use_atm && {CASH > 0}) then {
  93. [format[localize "STR_Cop_RobberDead",[CASH] call life_fnc_numberText]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
  94. CASH = 0;
  95. };
  96. };
  97.  
  98. if(!isNull _killer && {_killer != _unit}) then {
  99. life_removeWanted = true;
  100. };
  101.  
  102. _handle = [] spawn life_fnc_NLRTimer;
  103. waitUntil {scriptDone _handle};
  104.  
  105. _handle = [_unit] spawn life_fnc_dropItems;
  106. waitUntil {scriptDone _handle};
  107.  
  108. life_hunger = 100;
  109. life_thirst = 100;
  110. life_carryWeight = 0;
  111. CASH = 0;
  112.  
  113. [] call life_fnc_hudUpdate; //Get our HUD updated.
  114. [player,life_sidechat,playerSide] remoteExecCall ["TON_fnc_managesc",RSERV];
  115.  
  116. [0] call SOCK_fnc_updatePartial;
  117. [3] call SOCK_fnc_updatePartial;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement