Advertisement
Guest User

Fn_Jailmc.sqf

a guest
Feb 25th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 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.  
  17. if (_bad) then { _time = time + 1100; } else { _time = time + (15 * 60); };
  18.  
  19. if (count _ret > 0) then { life_bail_amount = (_ret select 2); } else { life_bail_amount = 1500; _time = time + (10 * 60); };
  20. _esc = false;
  21. _bail = false;
  22.  
  23. [_bad] spawn {
  24. life_canpay_bail = false;
  25. if (_this select 0) then {
  26. sleep (10 * 60);
  27. } else {
  28. sleep (5 * 60);
  29. };
  30. life_canpay_bail = true;
  31. };
  32.  
  33. for "_i" from 0 to 1 step 0 do {
  34. if ((round(_time - time)) > 0) then {
  35. _countDown = [(_time - time),"MM:SS.MS"] call BIS_fnc_secondsToString;
  36. 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"}];
  37. };
  38.  
  39. if (LIFE_SETTINGS(getNumber,"jail_forceWalk") isEqualTo 1) then {
  40. player forceWalk true;
  41. };
  42.  
  43. private _escDist = [[["Altis", 60], ["Stratis", 60], ["Tanoa", 145]]] call TON_fnc_terrainSort;
  44.  
  45. if (player distance (getMarkerPos "jail_marker") > _escDist) exitWith {
  46. _esc = true;
  47. };
  48.  
  49. if (life_bail_paid) exitWith {
  50. _bail = true;
  51. };
  52.  
  53. if ((round(_time - time)) < 1) exitWith {hint ""};
  54. if (!alive player && ((round(_time - time)) > 0)) exitWith {};
  55. sleep 0.1;
  56. };
  57.  
  58.  
  59. switch (true) do {
  60. case (_bail): {
  61. life_is_arrested = false;
  62. life_bail_paid = false;
  63.  
  64. hint localize "STR_Jail_Paid";
  65. player setPos (getMarkerPos "jail_release");
  66.  
  67. if (life_HC_isActive) then {
  68. [getPlayerUID player] remoteExecCall ["HC_fnc_wantedRemove",HC_Life];
  69. } else {
  70. [getPlayerUID player] remoteExecCall ["life_fnc_wantedRemove",RSERV];
  71. };
  72.  
  73. [5] call SOCK_fnc_updatePartial;
  74. };
  75.  
  76. case (_esc): {
  77. life_is_arrested = false;
  78. hint localize "STR_Jail_EscapeSelf";
  79. [0,"STR_Jail_EscapeNOTF",true,[profileName]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
  80.  
  81. if (life_HC_isActive) then {
  82. [getPlayerUID player,profileName,"901"] remoteExecCall ["HC_fnc_wantedAdd",HC_Life];
  83. } else {
  84. [getPlayerUID player,profileName,"901"] remoteExecCall ["life_fnc_wantedAdd",RSERV];
  85. };
  86.  
  87. [5] call SOCK_fnc_updatePartial;
  88. };
  89.  
  90. case (alive player && !_esc && !_bail): {
  91. life_is_arrested = false;
  92. hint localize "STR_Jail_Released";
  93.  
  94. if (life_HC_isActive) then {
  95. [getPlayerUID player] remoteExecCall ["HC_fnc_wantedRemove",HC_Life];
  96. } else {
  97. [getPlayerUID player] remoteExecCall ["life_fnc_wantedRemove",RSERV];
  98. };
  99.  
  100. player setPos (getMarkerPos "jail_release");
  101. [5] call SOCK_fnc_updatePartial;
  102. };
  103. };
  104.  
  105. player forceWalk false; // Enable running & jumping
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement