Advertisement
yeahhmonkey

Burnout 3.0

Nov 5th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.00 KB | None | 0 0
  1. using GTA;
  2. using GTA.Native;
  3. using System;
  4. using System.Windows.Forms;
  5.  
  6. public class Burnout : Script
  7. {
  8.  
  9. Ped player;
  10.  
  11. Vehicle veh;
  12.  
  13. ScriptSettings config;
  14.  
  15. private Keys toggleKey;
  16.  
  17. bool BurnoutOn = false;
  18.  
  19. private bool OnBurnoutOf;
  20.  
  21. float SmokeColorR;
  22. float SmokeColorG;
  23. float SmokeColorB;
  24.  
  25. int VehicleSmokeR;
  26. int VehicleSmokeG;
  27. int VehicleSmokeB;
  28.  
  29. bool SmokeColor = false; //color description
  30. bool VehicleSmokeColor = false; //color description
  31.  
  32. public Burnout()
  33.  
  34. {
  35.  
  36. Tick += OnTick;
  37.  
  38. KeyDown += OnKeyDown;
  39.  
  40. ReadINI(); //Read INI when the script it first loaded.
  41.  
  42. UI.Notify("~g~Loaded Burnout");
  43.  
  44. UI.Notify("~b~Please click the activate button 3 times to activate the mod. ~b~When you did that you can enable/Disable the mod by pressing the same button once");
  45. }
  46.  
  47. void ReadINI()
  48. {
  49. config = ScriptSettings.Load("scripts\\Burnout.ini");
  50.  
  51. toggleKey = config.GetValue<Keys>("Options", "toggleKey", Keys.L); ///This is the deault key that will be used, Unless changed in the Burnout.ini file.
  52.  
  53. SmokeColor = config.GetValue<bool>("Options", "SmokeColorEnable", false); ///This is the red color type.
  54. VehicleSmokeColor = config.GetValue<bool>("Options", "VehicleSmokeColorEnable", false); ///This is the red color type.
  55.  
  56.  
  57. SmokeColorR = config.GetValue<float>("SmokeColor", "SmokeColorR", 255); ///This is color code 1, default it's set to red.
  58.  
  59. SmokeColorG = config.GetValue<float>("SmokeColor", "SmokeColorG", 255); ///This is color code 2, default it's set to none.
  60.  
  61. SmokeColorB = config.GetValue<float>("SmokeColor", "SmokeColorB", 255); ///This is color code 3, default it's set to none.
  62.  
  63.  
  64. VehicleSmokeR = config.GetValue<int>("VehicleSmokeColor", "VehicleSmokeR", 255); ///This is color code 1, default it's set to none.
  65.  
  66. VehicleSmokeG = config.GetValue<int>("VehicleSmokeColor", "VehicleSmokeG", 255); ///This is color code 2, default it's set to none.
  67.  
  68. VehicleSmokeB = config.GetValue<int>("VehicleSmokeColor", "VehicleSmokeB", 255); ///This is color code 3, default it's set to none.
  69. }
  70.  
  71. void OnKeyDown(object sender, KeyEventArgs e)
  72.  
  73.  
  74. {
  75.  
  76. if (e.KeyCode == toggleKey)
  77.  
  78. {
  79. ReadINI(); //Read INI file whenever you press the togglekey
  80. OnBurnoutOf = !OnBurnoutOf;
  81.  
  82. Function.Call(Hash.SET_VEHICLE_BURNOUT, veh, OnBurnoutOf ? 1 : 0);
  83.  
  84. player = Game.Player.Character;
  85.  
  86.  
  87. if (player.IsInVehicle())
  88.  
  89. {
  90.  
  91. veh = player.CurrentVehicle;
  92.  
  93.  
  94.  
  95. {
  96.  
  97. BurnoutOn = !BurnoutOn;
  98. }
  99.  
  100. }
  101.  
  102. if (!veh.IsDriveable)
  103.  
  104. {
  105. BurnoutOn = false;
  106. }
  107.  
  108. }
  109.  
  110. if (!player.IsInVehicle())
  111.  
  112. {
  113. BurnoutOn = false;
  114. }
  115.  
  116. }
  117.  
  118.  
  119.  
  120.  
  121.  
  122. private void OnTick(object sender, EventArgs e)
  123.  
  124. {
  125.  
  126. float size = 0.8f; ///If you change this you can change the size of the smoke. #Default = 0.5
  127.  
  128.  
  129.  
  130. if (BurnoutOn == true)
  131.  
  132.  
  133.  
  134. {
  135. if (Function.Call<bool>(Hash.HAS_NAMED_PTFX_ASSET_LOADED, "scr_carsteal4"))
  136.  
  137. {
  138.  
  139. Function.Call(Hash._SET_PTFX_ASSET_NEXT_CALL, "scr_carsteal4");
  140.  
  141. Function.Call<int>(Hash.START_PARTICLE_FX_NON_LOOPED_ON_ENTITY, "scr_carsteal4_wheel_burnout", veh, -0.5f, -1.8f, 0.2f, -0, -0, -0, size, 0, 1, 0);
  142.  
  143.  
  144.  
  145. if (VehicleSmokeColor == true)
  146.  
  147. if (Game.Player.Character.IsInVehicle()) //check if player is in a vehicle first.
  148. {
  149.  
  150. Vehicle veh = Game.Player.Character.CurrentVehicle; //declare player's current vehicle as "veh"
  151. veh.InstallModKit(); //This prepares the vehicle "veh" to be modified
  152. Function.Call(Hash.TOGGLE_VEHICLE_MOD, veh, 20, true); //Enable vehicle tire smoke color
  153. Function.Call(Hash.SET_VEHICLE_TYRE_SMOKE_COLOR, veh, VehicleSmokeR, VehicleSmokeG, VehicleSmokeB); //This will change the tyresmoke color.
  154. }
  155.  
  156.  
  157. if (SmokeColor == true)
  158.  
  159. {
  160. Function.Call(Hash.SET_PARTICLE_FX_NON_LOOPED_COLOUR, SmokeColorR, SmokeColorG, SmokeColorB); //This will change the smoke color.
  161. }
  162.  
  163.  
  164. }
  165.  
  166.  
  167. else
  168.  
  169. {
  170. Function.Call(Hash.REQUEST_NAMED_PTFX_ASSET, "scr_carsteal4");
  171. }
  172.  
  173.  
  174.  
  175. if (Function.Call<bool>(Hash.HAS_NAMED_PTFX_ASSET_LOADED, "scr_carsteal4"))
  176.  
  177. {
  178. Function.Call(Hash._SET_PTFX_ASSET_NEXT_CALL, "scr_carsteal4");
  179. }
  180.  
  181. else
  182.  
  183. {
  184. Function.Call(Hash.REQUEST_NAMED_PTFX_ASSET, "scr_carsteal4");
  185. }
  186.  
  187. }
  188.  
  189. }
  190.  
  191. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement