Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using GTA;
- using GTA.Native;
- using System;
- using System.Windows.Forms;
- public class Burnout : Script
- {
- Ped player;
- Vehicle veh;
- ScriptSettings config;
- private Keys toggleKey;
- bool BurnoutOn = false;
- private bool OnBurnoutOf;
- float SmokeColorR;
- float SmokeColorG;
- float SmokeColorB;
- int VehicleSmokeR;
- int VehicleSmokeG;
- int VehicleSmokeB;
- bool SmokeColor = false; //color description
- bool VehicleSmokeColor = false; //color description
- public Burnout()
- {
- Tick += OnTick;
- KeyDown += OnKeyDown;
- ReadINI(); //Read INI when the script it first loaded.
- UI.Notify("~g~Loaded Burnout");
- 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");
- }
- void ReadINI()
- {
- config = ScriptSettings.Load("scripts\\Burnout.ini");
- toggleKey = config.GetValue<Keys>("Options", "toggleKey", Keys.L); ///This is the deault key that will be used, Unless changed in the Burnout.ini file.
- SmokeColor = config.GetValue<bool>("Options", "SmokeColorEnable", false); ///This is the red color type.
- VehicleSmokeColor = config.GetValue<bool>("Options", "VehicleSmokeColorEnable", false); ///This is the red color type.
- SmokeColorR = config.GetValue<float>("SmokeColor", "SmokeColorR", 255); ///This is color code 1, default it's set to red.
- SmokeColorG = config.GetValue<float>("SmokeColor", "SmokeColorG", 255); ///This is color code 2, default it's set to none.
- SmokeColorB = config.GetValue<float>("SmokeColor", "SmokeColorB", 255); ///This is color code 3, default it's set to none.
- VehicleSmokeR = config.GetValue<int>("VehicleSmokeColor", "VehicleSmokeR", 255); ///This is color code 1, default it's set to none.
- VehicleSmokeG = config.GetValue<int>("VehicleSmokeColor", "VehicleSmokeG", 255); ///This is color code 2, default it's set to none.
- VehicleSmokeB = config.GetValue<int>("VehicleSmokeColor", "VehicleSmokeB", 255); ///This is color code 3, default it's set to none.
- }
- void OnKeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == toggleKey)
- {
- ReadINI(); //Read INI file whenever you press the togglekey
- OnBurnoutOf = !OnBurnoutOf;
- Function.Call(Hash.SET_VEHICLE_BURNOUT, veh, OnBurnoutOf ? 1 : 0);
- player = Game.Player.Character;
- if (player.IsInVehicle())
- {
- veh = player.CurrentVehicle;
- {
- BurnoutOn = !BurnoutOn;
- }
- }
- if (!veh.IsDriveable)
- {
- BurnoutOn = false;
- }
- }
- if (!player.IsInVehicle())
- {
- BurnoutOn = false;
- }
- }
- private void OnTick(object sender, EventArgs e)
- {
- float size = 0.8f; ///If you change this you can change the size of the smoke. #Default = 0.5
- if (BurnoutOn == true)
- {
- if (Function.Call<bool>(Hash.HAS_NAMED_PTFX_ASSET_LOADED, "scr_carsteal4"))
- {
- Function.Call(Hash._SET_PTFX_ASSET_NEXT_CALL, "scr_carsteal4");
- 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);
- if (VehicleSmokeColor == true)
- if (Game.Player.Character.IsInVehicle()) //check if player is in a vehicle first.
- {
- Vehicle veh = Game.Player.Character.CurrentVehicle; //declare player's current vehicle as "veh"
- veh.InstallModKit(); //This prepares the vehicle "veh" to be modified
- Function.Call(Hash.TOGGLE_VEHICLE_MOD, veh, 20, true); //Enable vehicle tire smoke color
- Function.Call(Hash.SET_VEHICLE_TYRE_SMOKE_COLOR, veh, VehicleSmokeR, VehicleSmokeG, VehicleSmokeB); //This will change the tyresmoke color.
- }
- if (SmokeColor == true)
- {
- Function.Call(Hash.SET_PARTICLE_FX_NON_LOOPED_COLOUR, SmokeColorR, SmokeColorG, SmokeColorB); //This will change the smoke color.
- }
- }
- else
- {
- Function.Call(Hash.REQUEST_NAMED_PTFX_ASSET, "scr_carsteal4");
- }
- if (Function.Call<bool>(Hash.HAS_NAMED_PTFX_ASSET_LOADED, "scr_carsteal4"))
- {
- Function.Call(Hash._SET_PTFX_ASSET_NEXT_CALL, "scr_carsteal4");
- }
- else
- {
- Function.Call(Hash.REQUEST_NAMED_PTFX_ASSET, "scr_carsteal4");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement