Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.83 KB | None | 0 0
  1. /*
  2. File: fn_onPlayerKilled.sqf
  3. Author: Bryan "Tonic" Boardwine
  4.  
  5. Description:
  6. When the player dies collect various information about that player
  7. and pull up the death dialog / camera functionality.
  8. */
  9. private["_unit","_killer"];
  10. disableSerialization;
  11. _unit = [_this,0,ObjNull,[ObjNull]] call BIS_fnc_param;
  12. _killer = [_this,1,ObjNull,[ObjNull]] call BIS_fnc_param;
  13.  
  14. //Set some vars
  15. _unit setVariable["Revive",FALSE,TRUE]; //Set the corpse to a revivable state.
  16. _unit setVariable["name",profileName,TRUE]; //Set my name so they can say my name.
  17. _unit setVariable["restrained",FALSE,TRUE];
  18. _unit setVariable["Escorting",FALSE,TRUE];
  19. _unit setVariable["transporting",FALSE,TRUE]; //Why the fuck do I have this? Is it used?
  20. _unit setVariable["steam64id",(getPlayerUID player),true]; //Set the UID.
  21. _unit setVariable["missingOrgan",FALSE,TRUE]; //I DONT KNOW WHY SOMETIMES THEY ARE CAPS or not
  22. _unit setVariable["hasOrgan",FALSE,TRUE];
  23.  
  24. //Setup our camera view
  25. life_deathCamera = "CAMERA" camCreate (getPosATL _unit);
  26. showCinemaBorder TRUE;
  27. life_deathCamera cameraEffect ["Internal","Back"];
  28. createDialog "DeathScreen";
  29. life_deathCamera camSetTarget _unit;
  30. life_deathCamera camSetRelPos [0,3.5,4.5];
  31. life_deathCamera camSetFOV .5;
  32. life_deathCamera camSetFocus [50,0];
  33. life_deathCamera camCommit 0;
  34.  
  35. (findDisplay 7300) displaySetEventHandler ["KeyDown","if((_this select 1) == 1) then {true}"]; //Block the ESC menu
  36.  
  37. //Create a thread for something?
  38. _unit spawn
  39. {
  40. private["_maxTime","_RespawnBtn","_Timer"];
  41. disableSerialization;
  42. _RespawnBtn = ((findDisplay 7300) displayCtrl 7302);
  43. _Timer = ((findDisplay 7300) displayCtrl 7301);
  44.  
  45. _maxTime = time + (life_respawn_timer * 60);
  46. _RespawnBtn ctrlEnable false;
  47. waitUntil {_Timer ctrlSetText format[localize "STR_Medic_Respawn",[(_maxTime - time),"MM:SS.MS"] call BIS_fnc_secondsToString];
  48. round(_maxTime - time) <= 0 OR isNull _this};
  49. _RespawnBtn ctrlEnable true;
  50. _Timer ctrlSetText localize "STR_Medic_Respawn_2";
  51. };
  52.  
  53. [] spawn life_fnc_deathScreen;
  54.  
  55. //Create a thread to follow with some what precision view of the corpse.
  56. [_unit] spawn
  57. {
  58. private["_unit"];
  59. _unit = _this select 0;
  60. waitUntil {if(speed _unit == 0) exitWith {true}; life_deathCamera camSetTarget _unit; life_deathCamera camSetRelPos [0,3.5,4.5]; life_deathCamera camCommit 0;};
  61. };
  62.  
  63. //Make the killer wanted
  64. if(!isNull _killer && {_killer != _unit} && {side _killer != west} && {alive _killer}) then {
  65. if(vehicle _killer isKindOf "LandVehicle") then {
  66. [[getPlayerUID _killer,_killer getVariable["realname",name _killer],"187V"],"life_fnc_wantedAdd",false,false] spawn life_fnc_MP;
  67. //Get rid of this if you don't want automatic vehicle license removal.
  68. if(!local _killer) then {
  69. [[2],"life_fnc_removeLicenses",_killer,FALSE] spawn life_fnc_MP;
  70. };
  71. } else {
  72. [[getPlayerUID _killer,_killer getVariable["realname",name _killer],"187"],"life_fnc_wantedAdd",false,false] spawn life_fnc_MP;
  73.  
  74. if(!local _killer) then {
  75. [[3],"life_fnc_removeLicenses",_killer,FALSE] spawn life_fnc_MP;
  76. };
  77. };
  78. };
  79.  
  80. //Killed by cop stuff...
  81. if(side _killer == west && playerSide != west) then {
  82. life_copRecieve = _killer;
  83. //Did I rob the federal reserve?
  84. if(!life_use_atm && {life_cash > 0}) then {
  85. [format[localize "STR_Cop_RobberDead",[life_cash] call life_fnc_numberText],"life_fnc_broadcast",true,false] spawn life_fnc_MP;
  86. life_cash = 0;
  87. };
  88. };
  89.  
  90. if(!isNull _killer && {_killer != _unit}) then {
  91. life_removeWanted = true;
  92. };
  93.  
  94. _handle = [_unit] spawn life_fnc_dropItems;
  95. waitUntil {scriptDone _handle};
  96.  
  97. life_hunger = 100;
  98. life_thirst = 100;
  99. life_carryWeight = 0;
  100. life_cash = 0;
  101.  
  102. [] call life_fnc_hudUpdate; //Get our HUD updated.
  103. [[player,life_sidechat,playerSide],"TON_fnc_managesc",false,false] spawn life_fnc_MP;
  104.  
  105. [0] call SOCK_fnc_updatePartial;
  106. [3] call SOCK_fnc_updatePartial;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement