Advertisement
Guest User

Jail me

a guest
Dec 15th, 2018
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.13 KB | None | 0 0
  1.  
  2. Save New Duplicate & Edit Just Text Twitter
  3. >
  4. #include "..\..\script_macros.hpp"
  5. /*
  6. File: fn_jailMe.sqf
  7. Author Bryan "Tonic" Boardwine
  8.  
  9. Description:
  10. Once word is received by the server the rest of the jail execution is completed.
  11. */
  12. private ["_time","_bail","_esc","_countDown"];
  13.  
  14. params [
  15. ["_ret",[],[[]]],
  16. ["_bad",false,[false]]
  17. ];
  18.  
  19. //Begin jail uniform
  20. hint "Il tuo equipaggiamento è stato inserito nell' armadietto delle prove!";
  21. old_gear = getUnitLoadout player;
  22. removeUniform player;
  23. removeHeadgear player;
  24. removeVest player;
  25. removeGoggles player;
  26. removeBackpack player;
  27. removeallWeapons player;
  28. removeallAssignedItems player;
  29. player addUniform "U_C_Scientist";
  30. [] call life_fnc_playerSkins;
  31.  
  32. if (_bad) then { _time = time + 1100; } else { _time = time + (15 * 60); };
  33.  
  34. if (count _ret > 0) then { life_bail_amount = (_ret select 2); } else { life_bail_amount = 1500; _time = time + (10 * 60); };
  35. _esc = false;
  36. _bail = false;
  37.  
  38. [_bad] spawn {
  39. life_canpay_bail = false;
  40. if (_this select 0) then {
  41. sleep (10 * 60);
  42. } else {
  43. sleep (5 * 60);
  44. };
  45. life_canpay_bail = true;
  46. };
  47.  
  48. for "_i" from 0 to 1 step 0 do {
  49. if ((round(_time - time)) > 0) then {
  50. _countDown = [(_time - time),"MM:SS.MS"] call BIS_fnc_secondsToString;
  51. 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"}];
  52. };
  53.  
  54. if (LIFE_SETTINGS(getNumber,"jail_forceWalk") isEqualTo 1) then {
  55. player forceWalk true;
  56. };
  57.  
  58. private _escDist = [[["Altis", 60], ["Tanoa", 145]]] call TON_fnc_terrainSort;
  59.  
  60. if (player distance (getMarkerPos "jail_marker") > _escDist) exitWith {
  61. _esc = true;
  62. };
  63.  
  64. if (life_bail_paid) exitWith {
  65. _bail = true;
  66. };
  67.  
  68. if ((round(_time - time)) < 1) exitWith {hint ""};
  69. if (!alive player && ((round(_time - time)) > 0)) exitWith {};
  70. sleep 0.1;
  71. };
  72.  
  73. switch (true) do {
  74. case (_bail): {
  75. life_is_arrested = false;
  76. life_bail_paid = false;
  77.  
  78. hint localize "STR_Jail_Paid";
  79. player setPos (getMarkerPos "jail_release");
  80.  
  81. if (life_HC_isActive) then {
  82. [getPlayerUID player] remoteExecCall ["HC_fnc_wantedRemove",HC_Life];
  83. } else {
  84. [getPlayerUID player] remoteExecCall ["life_fnc_wantedRemove",RSERV];
  85. };
  86. player setUnitLoadout old_gear;
  87. hint "Poichè hai scontato la tua pena in prigione a breve riceverai i tuoi vestiti!";
  88. [] call life_fnc_saveGear;
  89. [5] call SOCK_fnc_updatePartial;
  90. };
  91.  
  92. case (_esc): {
  93. life_is_arrested = false;
  94. hint localize "STR_Jail_EscapeSelf";
  95. [0,"STR_Jail_EscapeNOTF",true,[profileName]] remoteExecCall ["life_fnc_broadcast",RCLIENT];
  96.  
  97. if (life_HC_isActive) then {
  98. [getPlayerUID player,profileName,"901"] remoteExecCall ["HC_fnc_wantedAdd",HC_Life];
  99. } else {
  100. [getPlayerUID player,profileName,"901"] remoteExecCall ["life_fnc_wantedAdd",RSERV];
  101. };
  102. hint "Poichè sei scappato dalla prigione i tuoi vestiti sono stati distrutti dalla polizia!";
  103. [] call life_fnc_saveGear;
  104.  
  105. [5] call SOCK_fnc_updatePartial;
  106. };
  107.  
  108. case (alive player && !_esc && !_bail): {
  109. life_is_arrested = false;
  110. hint localize "STR_Jail_Released";
  111.  
  112. if (life_HC_isActive) then {
  113. [getPlayerUID player] remoteExecCall ["HC_fnc_wantedRemove",HC_Life];
  114. } else {
  115. [getPlayerUID player] remoteExecCall ["life_fnc_wantedRemove",RSERV];
  116. };
  117. player setUnitLoadout old_gear;
  118. hint "Poichè hai scontato la tua pena in prigione a breve riceverai i tuoi vestiti!";
  119. [] call life_fnc_saveGear;
  120. player setPos (getMarkerPos "jail_release");
  121. [5] call SOCK_fnc_updatePartial;
  122. };
  123. };
  124.  
  125. player forceWalk false; // Enable running & jumping
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement