Advertisement
Guest User

Untitled

a guest
Jan 10th, 2018
241
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_jailMe.sqf
  4. Author Bryan "Tonic" Boardwine
  5.  
  6. Description:
  7. Once word is received by the server the rest of the jail execution is completed.
  8. */
  9. private ["_time","_bail","_esc","_countDown"];
  10.  
  11. params [
  12. ["_ret",[],[[]]],
  13. ["_bad",false,[false]]
  14. ];
  15.  
  16. //Begin jail uniform
  17. hint "Your gear has been placed in the evidence locker!";
  18. old_gear = getUnitLoadout player;
  19. removeUniform player;
  20. removeHeadgear player;
  21. removeVest player;
  22. removeGoggles player;
  23. removeBackpack player;
  24. removeallWeapons player;
  25. removeallAssignedItems player;
  26. player addUniform "jamie_prison";
  27.  
  28. if (_bad) then { _time = time + 1100; } else { _time = time + (15 * 60); };
  29.  
  30. if (count _ret > 0) then { life_bail_amount = (_ret select 2); } else { life_bail_amount = 1500; _time = time + (10 * 60); };
  31. _esc = false;
  32. _bail = false;
  33.  
  34. [_bad] spawn {
  35. life_canpay_bail = false;
  36. if (_this select 0) then {
  37. sleep (10 * 60);
  38. } else {
  39. sleep (5 * 60);
  40. };
  41. life_canpay_bail = true;
  42. };
  43.  
  44. for "_i" from 0 to 1 step 0 do {
  45. if ((round(_time - time)) > 0) then {
  46. _countDown = [(_time - time),"MM:SS.MS"] call BIS_fnc_secondsToString;
  47. hintSilent parseText format [(localize "STR_Jail_Time")+ "<br/> <t size='2'><t color='#FF0000'>%1</t></t><br/><br/>" +(localize "STR_Jail_Pay")+ " %3<br/>" +(localize "STR_Jail_Price")+ " $%2",_countDown,[life_bail_amount] call life_fnc_numberText,if (life_canpay_bail) then {"Yes"} else {"No"}];
  48. };
  49.  
  50. if (LIFE_SETTINGS(getNumber,"jail_forceWalk") isEqualTo 1) then {
  51. player forceWalk true;
  52. };
  53.  
  54. private _escDist = [[["Altis", 60], ["Tanoa", 145]]] call TON_fnc_terrainSort;
  55.  
  56. if (player distance (getMarkerPos "jail_marker") > _escDist) exitWith {
  57. _esc = true;
  58. };
  59.  
  60. if (life_bail_paid) exitWith {
  61. _bail = true;
  62. };
  63.  
  64. if ((round(_time - time)) < 1) exitWith {hint ""};
  65. if (!alive player && ((round(_time - time)) > 0)) exitWith {};
  66. sleep 0.1;
  67. };
  68.  
  69. switch (true) do {
  70. case (_bail): {
  71. life_is_arrested = false;
  72. life_bail_paid = false;
  73.  
  74. hint localize "STR_Jail_Paid";
  75. player setPos (getMarkerPos "jail_release");
  76.  
  77. if (life_HC_isActive) then {
  78. [getPlayerUID player] remoteExecCall ["HC_fnc_wantedRemove",HC_Life];
  79. } else {
  80. [getPlayerUID player] remoteExecCall ["life_fnc_wantedRemove",RSERV];
  81. };
  82. player setUnitLoadout old_gear;
  83. hint "Because you have done your time in prison, you will recieve your clothing shortly";
  84. [] call life_fnc_saveGear;
  85. [5] call SOCK_fnc_updatePartial;
  86. };
  87.  
  88. case (_esc): {
  89. life_is_arrested = false;
  90. hint localize "STR_Jail_EscapeSelf";
  91. [0,"STR_Jail_EscapeNOTF",true,[profileName]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
  92.  
  93. if (life_HC_isActive) then {
  94. [getPlayerUID player,profileName,"901"] remoteExecCall ["HC_fnc_wantedAdd",HC_Life];
  95. } else {
  96. [getPlayerUID player,profileName,"901"] remoteExecCall ["life_fnc_wantedAdd",RSERV];
  97. };
  98. hint "Because you escaped from jail, the jail guards have placed your gear in the trash";
  99. [] call life_fnc_saveGear;
  100.  
  101. [5] call SOCK_fnc_updatePartial;
  102. };
  103.  
  104. case (alive player && !_esc && !_bail): {
  105. life_is_arrested = false;
  106. hint localize "STR_Jail_Released";
  107.  
  108. if (life_HC_isActive) then {
  109. [getPlayerUID player] remoteExecCall ["HC_fnc_wantedRemove",HC_Life];
  110. } else {
  111. [getPlayerUID player] remoteExecCall ["life_fnc_wantedRemove",RSERV];
  112. };
  113. player setUnitLoadout old_gear;
  114. hint "Because you have done your time in prison, you will recieve your clothing shortly";
  115. [] call life_fnc_saveGear;
  116. player setPos (getMarkerPos "jail_release");
  117. [5] call SOCK_fnc_updatePartial;
  118. };
  119. };
  120.  
  121. player forceWalk false; // Enable running & jumping
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement