ashishcw

Burnout Code

Nov 4th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.96 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.  
  22.     float colorcode1;
  23.     float colorcode2;
  24.     float colorcode3;
  25.  
  26.     bool color = false; //redcolor description
  27.  
  28.    
  29.  
  30.     //bool greencolor = false; //greencolor description
  31.  
  32.     //bool bluecolor = false; //bluecolor description
  33.  
  34.     //bool yellowcolor = false; //yellowcolor description
  35.  
  36.     //bool blackcolor = false; //color description
  37.  
  38.     //bool lightbluecolor = false; //color description
  39.  
  40.     public Burnout()
  41.  
  42.     {
  43.  
  44.         Tick += OnTick;
  45.  
  46.         KeyDown += OnKeyDown;
  47.  
  48.  
  49.  
  50.         UI.Notify("~g~Loaded Burnout");
  51.  
  52.         ///  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");
  53.  
  54.         config = ScriptSettings.Load("scripts\\Burnout.ini");
  55.  
  56.  
  57.  
  58.         toggleKey = config.GetValue<Keys>("Options", "toggleKey", Keys.L);  ///This is the deault key that will be used, Unless changed in the Burnout.ini file.
  59.  
  60.         color = config.GetValue<bool>("Options", "colorenable", false); ///This is the red color type.
  61.  
  62.         colorcode1 = config.GetValue<float>("Colorcode", "Colorcode1", 255);  ///This is color code 1, default it's set to red.
  63.  
  64.         colorcode2 = config.GetValue<float>("Colorcode", "Colorcode2", 0);  ///This is color code 2, default it's set to none.
  65.  
  66.         colorcode3 = config.GetValue <float>("Colorcode", "Colorcode3", 0);  ///This is color code 3, default it's set to none.
  67.  
  68.         //greencolor = config.GetValue<bool>("Options", "GreencolorConfig", false); ///This is the green color type.
  69.  
  70.         //bluecolor = config.GetValue<bool>("Options", "bluecolorConfig", false); ///This is the blue color type.
  71.  
  72.         //yellowcolor = config.GetValue<bool>("Options", "yellowConfig", false); ///This is the yellow color type.
  73.  
  74.         //blackcolor = config.GetValue<bool>("Options", "blackcolorConfig", false); ///This is the black color type.
  75.  
  76.         //lightbluecolor = config.GetValue<bool>("Options", "lightbluecolorConfig", false); ///This is the color type.
  77.  
  78.     }
  79.  
  80.  
  81.  
  82.     void OnKeyDown(object sender, KeyEventArgs e)
  83.  
  84.     {
  85.  
  86.         if (e.KeyCode == toggleKey)
  87.  
  88.         {
  89.  
  90.             OnBurnoutOf = !OnBurnoutOf;
  91.  
  92.             Function.Call(Hash.SET_VEHICLE_BURNOUT, veh, OnBurnoutOf ? 1 : 0);
  93.  
  94.             player = Game.Player.Character;
  95.  
  96.  
  97.  
  98.             if (player.IsInVehicle())
  99.  
  100.             {
  101.  
  102.                 veh = player.CurrentVehicle;
  103.  
  104.  
  105.  
  106.                 {
  107.  
  108.                     BurnoutOn = !BurnoutOn;
  109.                 }
  110.  
  111.             }
  112.  
  113.             if (!veh.IsDriveable)
  114.  
  115.             {
  116.                 BurnoutOn = false;
  117.             }
  118.  
  119.         }
  120.  
  121.         if (!player.IsInVehicle())
  122.  
  123.         {
  124.             BurnoutOn = false;
  125.         }
  126.     }
  127.  
  128.  
  129.  
  130.     private void OnTick(object sender, EventArgs e)
  131.  
  132.     {
  133.  
  134.         float size = 0.8f; ///If you change this you can change the size of the smoke. #Default = 0.5
  135.  
  136.  
  137.  
  138.         if (BurnoutOn == true)
  139.  
  140.  
  141.  
  142.         {
  143.  
  144.  
  145.  
  146.             if (Function.Call<bool>(Hash.HAS_NAMED_PTFX_ASSET_LOADED, "scr_carsteal4"))
  147.  
  148.             {
  149.  
  150.                 Function.Call(Hash._SET_PTFX_ASSET_NEXT_CALL, "scr_carsteal4");
  151.  
  152.                 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);
  153.  
  154.  
  155.  
  156.  
  157.  
  158.                 if (color == true)
  159.  
  160.                 {
  161.  
  162.                     //Function.Call(Hash.SET_PARTICLE_FX_NON_LOOPED_COLOUR, 255f, 0f, 0f); //This will change the smoke color to red.
  163.  
  164.                     Function.Call(Hash.SET_PARTICLE_FX_NON_LOOPED_COLOUR, colorcode1, colorcode2, colorcode3); //This will change the smoke color to red.
  165.  
  166.                     //greencolor = false;
  167.  
  168.                     //bluecolor = false;
  169.  
  170.                     //yellowcolor = false;
  171.  
  172.                     //blackcolor = false;
  173.  
  174.                     //lightbluecolor = false;
  175.  
  176.                 }
  177.  
  178.  
  179.  
  180.                 //if (bluecolor == true)
  181.  
  182.                 //{
  183.  
  184.                 //    Function.Call(Hash.SET_PARTICLE_FX_NON_LOOPED_COLOUR, 0f, 0f, 255f); //This will change the smoke color to green.
  185.  
  186.                 //    redcolor = false;
  187.  
  188.                 //    greencolor = false;
  189.  
  190.                 //    yellowcolor = false;
  191.  
  192.                 //    blackcolor = false;
  193.  
  194.                 //    lightbluecolor = false;
  195.                 //}
  196.  
  197.  
  198.  
  199.                 //if (greencolor == true)
  200.  
  201.                 //{
  202.  
  203.                 //    Function.Call(Hash.SET_PARTICLE_FX_NON_LOOPED_COLOUR, 0f, 255f, 0f); //This will change the smoke color to blue.
  204.  
  205.                 //    redcolor = false;
  206.  
  207.                 //    bluecolor = false;
  208.  
  209.                 //    yellowcolor = false;
  210.  
  211.                 //    blackcolor = false;
  212.  
  213.                 //    lightbluecolor = false;
  214.  
  215.                 //}
  216.  
  217.  
  218.  
  219.                 //if (yellowcolor == true)
  220.  
  221.                 //{
  222.  
  223.                 //    Function.Call(Hash.SET_PARTICLE_FX_NON_LOOPED_COLOUR, 255f, 88f, 0f); //This will change the smoke color to yellow.
  224.  
  225.                 //    redcolor = false;
  226.  
  227.                 //    bluecolor = false;
  228.  
  229.                 //    greencolor = false;
  230.  
  231.                 //    blackcolor = false;
  232.  
  233.                 //    lightbluecolor = false;
  234.  
  235.                 //}
  236.  
  237.  
  238.  
  239.                 //if (blackcolor == true)
  240.  
  241.                 //{
  242.  
  243.                 //    Function.Call(Hash.SET_PARTICLE_FX_NON_LOOPED_COLOUR, 0f, 0f, 0f); //This will change the smoke color to blue.
  244.  
  245.                 //    redcolor = false;
  246.  
  247.                 //    bluecolor = false;
  248.  
  249.                 //    greencolor = false;
  250.  
  251.                 //    yellowcolor = false;
  252.  
  253.                 //    lightbluecolor = false;
  254.                 //}
  255.  
  256.  
  257.  
  258.                 //if (lightbluecolor == true)
  259.  
  260.                 //{
  261.  
  262.                 //    Function.Call(Hash.SET_PARTICLE_FX_NON_LOOPED_COLOUR, 00f, 60f, 60f); //This will change the smoke color to blue.
  263.  
  264.                 //    redcolor = false;
  265.  
  266.                 //    bluecolor = false;
  267.  
  268.                 //    greencolor = false;
  269.  
  270.                 //    yellowcolor = false;
  271.  
  272.                 //    blackcolor = false;
  273.                 //}
  274.  
  275.  
  276.             }
  277.  
  278.             else
  279.  
  280.             {
  281.  
  282.                 Function.Call(Hash.REQUEST_NAMED_PTFX_ASSET, "scr_carsteal4");
  283.  
  284.             }
  285.  
  286.  
  287.  
  288.             if (Function.Call<bool>(Hash.HAS_NAMED_PTFX_ASSET_LOADED, "scr_carsteal4"))
  289.  
  290.             {
  291.  
  292.                 Function.Call(Hash._SET_PTFX_ASSET_NEXT_CALL, "scr_carsteal4");
  293.  
  294.             }
  295.  
  296.             else
  297.  
  298.             {
  299.  
  300.                 Function.Call(Hash.REQUEST_NAMED_PTFX_ASSET, "scr_carsteal4");
  301.  
  302.  
  303.  
  304.             }
  305.  
  306.         }
  307.  
  308.     }
  309.  
  310. }
Add Comment
Please, Sign In to add comment