Advertisement
Guest User

Untitled

a guest
Jun 19th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.74 KB | None | 0 0
  1. /*
  2. Module: Breaking Vehicle
  3. Created by: L3o
  4. */
  5.  
  6. #include <YSI\y_hooks>
  7.  
  8. //=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ [DEFINES]
  9.  
  10.  
  11. //=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ [VARIABLES]
  12.  
  13. new
  14. PlayerBar:BreakingBar[MAX_PLAYERS],
  15. PlayerText:BreakingTextdraws[MAX_PLAYERS][4],
  16. PlayerBreakingVehicle[MAX_PLAYERS];
  17.  
  18.  
  19. //=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ [STOCKS]
  20. stock CreateBreakingTextdraws(playerid, bool:created)
  21. {
  22. if(created == false) {
  23. for(new i = 0; i < 4; i++) {
  24. PlayerTextDrawHide(playerid, BreakingTextdraws[playerid][i]);
  25. }
  26. HidePlayerProgressBar(playerid, BreakingBar[playerid]);
  27. }
  28. else if(created == true) {
  29. BreakingTextdraws[playerid][0] = CreatePlayerTextDraw(playerid, 276.333374, 377.081481, "box");
  30. PlayerTextDrawLetterSize(playerid, BreakingTextdraws[playerid][0], 0.000000, 4.899999);
  31. PlayerTextDrawTextSize(playerid, BreakingTextdraws[playerid][0], 368.000000, 0.000000);
  32. PlayerTextDrawAlignment(playerid, BreakingTextdraws[playerid][0], 1);
  33. PlayerTextDrawColor(playerid, BreakingTextdraws[playerid][0], -1);
  34. PlayerTextDrawUseBox(playerid, BreakingTextdraws[playerid][0], 1);
  35. PlayerTextDrawBoxColor(playerid, BreakingTextdraws[playerid][0], 170);
  36. PlayerTextDrawSetShadow(playerid, BreakingTextdraws[playerid][0], 0);
  37. PlayerTextDrawSetOutline(playerid, BreakingTextdraws[playerid][0], 0);
  38. PlayerTextDrawBackgroundColor(playerid, BreakingTextdraws[playerid][0], 255);
  39. PlayerTextDrawFont(playerid, BreakingTextdraws[playerid][0], 1);
  40. PlayerTextDrawSetProportional(playerid, BreakingTextdraws[playerid][0], 1);
  41. PlayerTextDrawSetShadow(playerid, BreakingTextdraws[playerid][0], 0);
  42.  
  43. BreakingTextdraws[playerid][1] = CreatePlayerTextDraw(playerid, 292.000213, 370.444549, "breaking_vehicle");
  44. PlayerTextDrawLetterSize(playerid, BreakingTextdraws[playerid][1], 0.208996, 0.944589);
  45. PlayerTextDrawAlignment(playerid, BreakingTextdraws[playerid][1], 1);
  46. PlayerTextDrawColor(playerid, BreakingTextdraws[playerid][1], -1);
  47. PlayerTextDrawSetShadow(playerid, BreakingTextdraws[playerid][1], 0);
  48. PlayerTextDrawSetOutline(playerid, BreakingTextdraws[playerid][1], 1);
  49. PlayerTextDrawBackgroundColor(playerid, BreakingTextdraws[playerid][1], 255);
  50. PlayerTextDrawFont(playerid, BreakingTextdraws[playerid][1], 3);
  51. PlayerTextDrawSetProportional(playerid, BreakingTextdraws[playerid][1], 1);
  52. PlayerTextDrawSetShadow(playerid, BreakingTextdraws[playerid][1], 0);
  53.  
  54. BreakingTextdraws[playerid][2] = CreatePlayerTextDraw(playerid, 309.933288, 386.737060, "press_'y'_");
  55. PlayerTextDrawLetterSize(playerid, BreakingTextdraws[playerid][2], 0.123666, 1.110517);
  56. PlayerTextDrawAlignment(playerid, BreakingTextdraws[playerid][2], 1);
  57. PlayerTextDrawColor(playerid, BreakingTextdraws[playerid][2], -1);
  58. PlayerTextDrawSetShadow(playerid, BreakingTextdraws[playerid][2], 0);
  59. PlayerTextDrawSetOutline(playerid, BreakingTextdraws[playerid][2], 1);
  60. PlayerTextDrawBackgroundColor(playerid, BreakingTextdraws[playerid][2], 255);
  61. PlayerTextDrawFont(playerid, BreakingTextdraws[playerid][2], 2);
  62. PlayerTextDrawSetProportional(playerid, BreakingTextdraws[playerid][2], 1);
  63. PlayerTextDrawSetShadow(playerid, BreakingTextdraws[playerid][2], 0);
  64.  
  65. BreakingTextdraws[playerid][3] = CreatePlayerTextDraw(playerid, 321.333984, 410.838531, "time:_50_seconds");
  66. PlayerTextDrawLetterSize(playerid, BreakingTextdraws[playerid][3], 0.123666, 1.110517);
  67. PlayerTextDrawAlignment(playerid, BreakingTextdraws[playerid][3], 2);
  68. PlayerTextDrawColor(playerid, BreakingTextdraws[playerid][3], -1);
  69. PlayerTextDrawSetShadow(playerid, BreakingTextdraws[playerid][3], 0);
  70. PlayerTextDrawSetOutline(playerid, BreakingTextdraws[playerid][3], 1);
  71. PlayerTextDrawBackgroundColor(playerid, BreakingTextdraws[playerid][3], 255);
  72. PlayerTextDrawFont(playerid, BreakingTextdraws[playerid][3], 2);
  73. PlayerTextDrawSetProportional(playerid, BreakingTextdraws[playerid][3], 1);
  74. PlayerTextDrawSetShadow(playerid, BreakingTextdraws[playerid][3], 0);
  75.  
  76. ShowPlayerProgressBar(playerid, BreakingBar[playerid]);
  77. for(new i = 0; i < 4; i++) {
  78. PlayerTextDrawShow(playerid, BreakingTextdraws[playerid][i]);
  79. }
  80. }
  81. return (true);
  82. }
  83.  
  84. //=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ [HOOKS]
  85.  
  86. hook OnPlayerConnect(playerid)
  87. {
  88. BreakingBar[playerid] = CreatePlayerProgressBar(playerid, 294.000000, 400.000000, 56.500000, 3.200000, 866792362, 100.0000, 0);
  89. return 1;
  90. }
  91.  
  92. //=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ [COMMANDS]
  93.  
  94. CMD:breakvehicle(playerid, params[])
  95. {
  96. new action[25],
  97. vehicleid = GetNearestVehicle(playerid),Float:Pos[3],
  98. carid = isCOSVehicle(vehicleid);
  99.  
  100. if(sscanf(params, "s[25] ", action))
  101. {
  102. SendCOMMANDMessage(playerid, "/breakvehicle [action].");
  103. SCM(playerid, 0xAFAFAFAA, "[actions] start, stop");
  104. return (true);
  105. }
  106.  
  107. if(strcmp(action,"start",true) == 0)
  108. {
  109. if(carid != (-1))
  110. {
  111. GetVehiclePos(vehicleid, Pos[0], Pos[1], Pos[2]);
  112. if(VehicleData[carid][VehicleLocked] == 1 && IsPlayerInRangeOfPoint(playerid, 2.5, Pos[0], Pos[1], Pos[2]))
  113. {
  114. if(isequal(GetName(playerid), VehicleData[carid][vehicleOwner]))
  115. return SendErrorMessage(playerid,"Ne mozete obiti svoje vozilo.");
  116.  
  117. CreateBreakingTextdraws(playerid, true); PlayerBreakingVehicle[playerid] = 1;
  118. SendInfoMessage(playerid, "Poceli ste sa obijanjem vozila, da odustanete kucajte /stopbreaking.");
  119. }
  120. }
  121. }
  122.  
  123. if(strcmp(action,"stop",true) == 0)
  124. {
  125. if(PlayerBreakingVehicle[playerid] == 1)
  126. {
  127. ClearAnimations(playerid); PlayerBreakingVehicle[playerid] = 0;
  128. CreateBreakingTextdraws(playerid, false);
  129. }
  130. }
  131.  
  132. return (true);
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement