Guest User

Untitled

a guest
Jul 23rd, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. using System;
  2. using System.Windows.Forms;
  3. using GTA;
  4.  
  5.  
  6.  
  7.  
  8.  
  9. public class FixaFlat : Script
  10. {
  11. Vehicle ClosestVehicle = null;
  12. bool FrontTiresPopped;
  13. bool RearTiresPopped;
  14.  
  15. public FixaFlat()
  16. {
  17. Interval = 250;
  18. this.Tick += new EventHandler(this.FixaFlat_Tick);
  19. this.KeyDown += new GTA.KeyEventHandler(this.FixaFlat_KeyDown);
  20. }
  21.  
  22. private void FixaFlat_KeyDown(object sender, GTA.KeyEventArgs e)
  23. {
  24. if (e.Key == Keys.Z && FrontTiresPopped)
  25. {
  26. ClosestVehicle.FixTire(VehicleWheel.FrontLeft);
  27. ClosestVehicle.FixTire(VehicleWheel.FrontRight);
  28.  
  29. }
  30.  
  31. if (e.Key == Keys.X && RearTiresPopped)
  32. {
  33. ClosestVehicle.FixTire(VehicleWheel.RearLeft);
  34. ClosestVehicle.FixTire(VehicleWheel.RearRight);
  35.  
  36. }
  37. }
  38. private void FixaFlat_Tick(object sender, EventArgs e)
  39. {
  40. ClosestVehicle = World.GetClosestVehicle(Player.Character.Position, 5.0F);
  41.  
  42. if (ClosestVehicle != null && ClosestVehicle.Exists() &&
  43. ClosestVehicle.IsTireBurst(VehicleWheel.FrontLeft))
  44. {
  45. FrontTiresPopped = true;
  46. }
  47. if (ClosestVehicle != null && ClosestVehicle.Exists() &&
  48. ClosestVehicle.IsTireBurst(VehicleWheel.FrontRight))
  49. {
  50. FrontTiresPopped = true;
  51. }
  52.  
  53. if (ClosestVehicle != null && ClosestVehicle.Exists() &&
  54. ClosestVehicle.IsTireBurst(VehicleWheel.RearLeft))
  55. {
  56. RearTiresPopped = true;
  57. }
  58.  
  59. if (ClosestVehicle != null && ClosestVehicle.Exists() &&
  60. ClosestVehicle.IsTireBurst(VehicleWheel.RearRight))
  61. {
  62. RearTiresPopped = true;
  63. }
  64. }
  65. }
Add Comment
Please, Sign In to add comment