Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using GTA;
- using GTA.Native;
- using GTA.Math;
- using NativeUI;
- using System.IO;
- using System.Drawing;
- namespace EnhancedDrivingExperience
- {
- public class EnhancedDrivingExperience : Script
- {
- ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\EDE.ini");
- // private bool lights;
- // private bool engineStat;
- private bool indicatorLeft;
- private bool indicatorRight;
- private bool windowStat;
- private bool seatbelt = false;
- private bool handbrake;
- private bool handIdle;
- private bool hazardLights;
- NAudio.Wave.WaveFileReader WavereaderDown;
- NAudio.Wave.WaveChannel32 wavechanDown;
- NAudio.Wave.DirectSoundOut DSODown;
- float volumeDown;
- public EnhancedDrivingExperience()
- {
- Tick += OnTick;
- KeyDown += OnKeyDown;
- KeyUp += OnKeyUP;
- }
- private void OnKeyUP(object sender, KeyEventArgs e)
- {
- }
- private void OnTick(object sender, EventArgs e)
- {
- //LIGHTS
- // if (Game.Player.Character.CurrentVehicle.EngineRunning == false & Game.Player.Character.LastVehicle.EngineRunning == false) {
- // Function.Call(Hash.SET_VEHICLE_LIGHTS, Game.Player.Character.CurrentVehicle, 0);
- // lights = false;
- // }
- //if (lights == true)
- // {
- // Function.Call(Hash.SET_VEHICLE_LIGHTS, Game.Player.Character.CurrentVehicle, 2);
- // }
- // else
- // {
- // Function.Call(Hash.SET_VEHICLE_LIGHTS, Game.Player.Character.CurrentVehicle, 0);
- // }
- //WINDOWSTAT
- if (!Function.Call<bool>(Hash.IS_VEHICLE_WINDOW_INTACT, Game.Player.Character.CurrentVehicle,0))
- {
- //windowStat = true;
- }
- if (!Game.Player.Character.IsInVehicle())
- {
- seatbelt = false;
- handIdle = false;
- windowStat = false;
- handbrake = false;
- }
- //SEATBELT
- if (seatbelt == true) {
- Function.Call(Hash.SET_PED_CONFIG_FLAG, Game.Player.Character, 32, false);
- } else
- {
- Function.Call(Hash.SET_PED_CONFIG_FLAG, Game.Player.Character, 32, true);
- }
- if (Game.Player.Character.IsInVehicle() && seatbelt == false && !Function.Call<bool>(Hash.IS_CUTSCENE_ACTIVE))
- {
- float x = config.GetValue<float>("Settings", "x", 190f);
- int xf = (int)x;
- float y = config.GetValue<float>("Settings", "y", 640f);
- int yf = (int)y;
- float Width = config.GetValue<float>("Settings", "Width", 50f);
- int Widthf = (int)Width;
- float Height = config.GetValue<float>("Settings", "Height", 50f);
- int Heightf = (int)Height;
- if (config.GetValue<bool>("SETTINGS", "ICON_DRAW", true))
- {
- GTA.UI.DrawTexture(".\\Scripts\\EDE\\chime.png", 0, 1, 1500, new Point(xf, yf), new Size(Widthf, Heightf));
- }
- }
- //handIdle
- if (handIdle == true && Game.Player.Character.IsInVehicle())
- {
- windowStat = true;
- }
- if (windowStat == true && Game.Player.Character.IsInVehicle())
- {
- Function.Call(Hash.ROLL_DOWN_WINDOW, Game.Player.Character.CurrentVehicle, 0);
- } else
- {
- Function.Call(Hash.ROLL_UP_WINDOW, Game.Player.Character.CurrentVehicle, 0);
- }
- //Handbrake
- if (handbrake == true && Game.Player.Character.IsInVehicle())
- {
- Function.Call(Hash.SET_VEHICLE_HANDBRAKE, Game.Player.Character.CurrentVehicle, true);
- }
- else
- {
- Function.Call(Hash.SET_VEHICLE_HANDBRAKE, Game.Player.Character.CurrentVehicle, false);
- }
- }
- private void OnKeyDown(object sender, KeyEventArgs e)
- {
- //HANDIDLE
- if (e.Shift && Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "LOWRIDER_IDLE_SWITCH_KEY", Keys.R)) && Game.Player.Character.IsInVehicle() && !Function.Call<bool>(Hash.IS_PED_ON_ANY_BIKE, Game.Player.Character) && !Function.Call<bool>(Hash.IS_PED_IN_ANY_BOAT, Game.Player.Character) && !Function.Call<bool>(Hash.IS_PED_IN_ANY_HELI, Game.Player.Character) && !Function.Call<bool>(Hash.IS_PED_IN_ANY_PLANE, Game.Player.Character))
- {
- if (handIdle == false && windowStat == true)
- {
- Function.Call(Hash.REQUEST_ANIM_DICT, "anim@veh@lowrider@std@ds@arm@base");
- while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, "anim@veh@lowrider@std@ds@arm@base")) Wait(10);
- Game.Player.Character.Task.ClearAll();
- Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character, "anim@veh@lowrider@std@ds@arm@base", "steer_lean_left_low_lowdoor", 3.1f, -3.1f, -1, 48 | 2, 0f, 0, 0, 0);
- handIdle = true;
- } else
- {
- Game.Player.Character.Task.ClearAll();
- handIdle = false;
- }
- }
- //LIGHTS
- if (Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "LEFT_INDICATOR_KEY", Keys.Q)) && Game.Player.Character.IsInVehicle() && Game.Player.Character.CurrentVehicle.EngineRunning == true)
- {
- Function.Call(Hash.REQUEST_ANIM_DICT, "weapons@pistol@");
- while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, "weapons@pistol@")) Wait(10);
- Game.Player.Character.Task.ClearAll();
- Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character, "weapons@pistol@", "walk", 33.1f, -2.1f, -1, 48, 0f, 0, 0, 0);
- Wait(300);
- Game.Player.Character.Task.ClearAll();
- if (File.Exists(@"scripts\EDE\indicator.wav"))
- {
- ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\EDE.ini");
- WavereaderDown = new NAudio.Wave.WaveFileReader(@"scripts\EDE\indicator.wav");
- wavechanDown = new NAudio.Wave.WaveChannel32(WavereaderDown);
- volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
- DSODown = new NAudio.Wave.DirectSoundOut();
- DSODown.Init(wavechanDown);
- wavechanDown.Volume = (volumeDown / 100);
- DSODown.Play();
- DSODown.Dispose();
- }
- else
- {
- UI.ShowSubtitle("indicator.wav" + " is not found!");
- }
- if (indicatorLeft == true)
- {
- Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 0, false);
- Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 1, false);
- indicatorLeft = false;
- indicatorRight = false;
- }
- else
- {
- Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 0, false);
- Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 1, true);
- indicatorLeft = true;
- indicatorRight = false;
- }
- }
- if (Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "RIGHT_INDICATOR_KEY", Keys.T)) && Game.Player.Character.IsInVehicle() && Game.Player.Character.CurrentVehicle.EngineRunning == true)
- {
- Function.Call(Hash.REQUEST_ANIM_DICT, "weapons@pistol@");
- while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, "weapons@pistol@")) Wait(10);
- Game.Player.Character.Task.ClearAll();
- Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character, "weapons@pistol@", "walk", 33.1f, -2.1f, -1, 48, 0f, 0, 0, 0);
- Wait(300);
- Game.Player.Character.Task.ClearAll();
- if (File.Exists(@"scripts\EDE\indicator.wav"))
- {
- ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\EDE.ini");
- WavereaderDown = new NAudio.Wave.WaveFileReader(@"scripts\EDE\indicator.wav");
- wavechanDown = new NAudio.Wave.WaveChannel32(WavereaderDown);
- volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
- DSODown = new NAudio.Wave.DirectSoundOut();
- DSODown.Init(wavechanDown);
- wavechanDown.Volume = (volumeDown / 100);
- DSODown.Play();
- DSODown.Dispose();
- }
- else
- {
- UI.ShowSubtitle("indicator.wav" + " is not found!");
- }
- if (indicatorRight == true)
- {
- Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 0, false);
- Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 1, false);
- indicatorLeft = false;
- indicatorRight = false;
- }
- else
- {
- Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 1, false);
- Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 0, true);
- indicatorLeft = false;
- indicatorRight = true;
- }
- }
- if (Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "HAZARD_LIGHTS_KEY", Keys.U)) && Game.Player.Character.IsInVehicle() && Game.Player.Character.CurrentVehicle.EngineRunning == true)
- {
- Function.Call(Hash.REQUEST_ANIM_DICT, "weapons@pistol@");
- while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, "weapons@pistol@")) Wait(10);
- Game.Player.Character.Task.ClearAll();
- Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character, "weapons@pistol@", "walk", 33.1f, -2.1f, -1, 48, 0f, 0, 0, 0);
- Wait(300);
- Game.Player.Character.Task.ClearAll();
- if (File.Exists(@"scripts\EDE\indicator.wav"))
- {
- ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\EDE.ini");
- WavereaderDown = new NAudio.Wave.WaveFileReader(@"scripts\EDE\indicator.wav");
- wavechanDown = new NAudio.Wave.WaveChannel32(WavereaderDown);
- volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
- DSODown = new NAudio.Wave.DirectSoundOut();
- DSODown.Init(wavechanDown);
- wavechanDown.Volume = (volumeDown / 100);
- DSODown.Play();
- DSODown.Dispose();
- }
- else
- {
- UI.ShowSubtitle("indicator.wav" + " is not found!");
- }
- if (hazardLights == true)
- {
- Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 0, false);
- Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 1, false);
- indicatorLeft = false;
- indicatorRight = false;
- hazardLights = false;
- }
- else
- {
- Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 0, true);
- Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 1, true);
- indicatorLeft = true;
- indicatorRight = true;
- hazardLights = true;
- }
- }
- if (Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "LIGHTS_KEY", Keys.L)) && Game.Player.Character.IsInVehicle() && Game.Player.Character.CurrentVehicle.EngineRunning == true)
- {
- Function.Call(Hash.REQUEST_ANIM_DICT, "weapons@pistol@");
- while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, "weapons@pistol@")) Wait(10);
- Game.Player.Character.Task.ClearAll();
- Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character, "weapons@pistol@", "walk", 33.1f, -2.1f, -1, 48, 0f, 0, 0, 0);
- Wait(300);
- Game.Player.Character.Task.ClearAll();
- if (File.Exists(@"scripts\EDE\indicator.wav"))
- {
- ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\EDE.ini");
- WavereaderDown = new NAudio.Wave.WaveFileReader(@"scripts\EDE\indicator.wav");
- wavechanDown = new NAudio.Wave.WaveChannel32(WavereaderDown);
- volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
- DSODown = new NAudio.Wave.DirectSoundOut();
- DSODown.Init(wavechanDown);
- wavechanDown.Volume = (volumeDown / 100);
- DSODown.Play();
- DSODown.Dispose();
- }
- else
- {
- UI.ShowSubtitle("indicator.wav" + " is not found!");
- }
- // if (lights == false)
- // {
- // Function.Call(Hash.SET_VEHICLE_LIGHTS, Game.Player.Character.CurrentVehicle, 2);
- // lights = true;
- // } else
- // {
- // Function.Call(Hash.SET_VEHICLE_LIGHTS, Game.Player.Character.CurrentVehicle, 0);
- // lights = false;
- // }
- }
- //WINDOW
- if (Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "WINDOW_OPEN_KEY", Keys.Y)) && !Function.Call<bool>(Hash.IS_VEHICLE_WINDOW_INTACT,0) && Game.Player.Character.IsInVehicle() && !Function.Call<bool>(Hash.IS_PED_ON_ANY_BIKE, Game.Player.Character) && !Function.Call<bool>(Hash.IS_PED_IN_ANY_BOAT, Game.Player.Character) && !Function.Call<bool>(Hash.IS_PED_IN_ANY_HELI, Game.Player.Character) && !Function.Call<bool>(Hash.IS_PED_IN_ANY_PLANE, Game.Player.Character))
- {
- Function.Call(Hash.REQUEST_ANIM_DICT, "weapons@pistol@");
- while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, "weapons@pistol@")) Wait(10);
- Game.Player.Character.Task.ClearAll();
- if (windowStat == false)
- {
- Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character, "weapons@pistol@", "walk", 2.1f, -2.1f, -1, 48, 0f, 0, 0, 0);
- Wait(300);
- Game.Player.Character.Task.ClearAll();
- Function.Call(Hash.ROLL_DOWN_WINDOW, Game.Player.Character.CurrentVehicle, 0);
- if (File.Exists(@"scripts\EDE\window.wav"))
- {
- ScriptSettings config = ScriptSettings.Load(@"scripts\bca\EDE.ini");
- WavereaderDown = new NAudio.Wave.WaveFileReader(@"scripts\EDE\window.wav");
- wavechanDown = new NAudio.Wave.WaveChannel32(WavereaderDown);
- volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
- DSODown = new NAudio.Wave.DirectSoundOut();
- DSODown.Init(wavechanDown);
- wavechanDown.Volume = (volumeDown / 100);
- DSODown.Play();
- DSODown.Dispose();
- }
- else
- {
- UI.ShowSubtitle("window.wav" + " is not found!");
- }
- windowStat = true;
- } else if (windowStat == true)
- {
- Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character, "weapons@pistol@", "walk", 2.1f, -2.1f, -1, 48, 0f, 0, 0, 0);
- Wait(300);
- Game.Player.Character.Task.ClearAll();
- Function.Call(Hash.ROLL_UP_WINDOW, Game.Player.Character.CurrentVehicle, 0);
- if (File.Exists(@"scripts\EDE\window.wav"))
- {
- ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\EDE.ini");
- WavereaderDown = new NAudio.Wave.WaveFileReader(@"scripts\EDE\window.wav");
- wavechanDown = new NAudio.Wave.WaveChannel32(WavereaderDown);
- volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
- DSODown = new NAudio.Wave.DirectSoundOut();
- DSODown.Init(wavechanDown);
- wavechanDown.Volume = (volumeDown / 100);
- DSODown.Play();
- DSODown.Dispose();
- }
- else
- {
- UI.ShowSubtitle("window.wav" + " is not found!");
- }
- windowStat = false;
- }
- }
- //HANDBREAK
- //Game.Player.Character.IsStopped &&
- if (e.Control && Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "HANDBAKE_KEY", Keys.H)) && Game.Player.Character.IsInVehicle() && !Function.Call<bool>(Hash.IS_PED_ON_ANY_BIKE, Game.Player.Character) && !Function.Call<bool>(Hash.IS_PED_IN_ANY_BOAT, Game.Player.Character) && !Function.Call<bool>(Hash.IS_PED_IN_ANY_HELI, Game.Player.Character) && !Function.Call<bool>(Hash.IS_PED_IN_ANY_PLANE, Game.Player.Character))
- {
- //UI.Notify("Handbreak");
- Function.Call(Hash.REQUEST_ANIM_DICT, "weapon@w_sp_jerrycan");
- while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, "weapon@w_sp_jerrycan")) Wait(10);
- Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character, "weapon@w_sp_jerrycan", "unholster", 45.5f, -6.0f, -1, 48, 0f, 0, 0, 0);
- Wait(390);
- if (File.Exists(@"scripts\EDE\handbreak.wav"))
- {
- ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\EDE.ini");
- WavereaderDown = new NAudio.Wave.WaveFileReader(@"scripts\EDE\handbreak.wav");
- wavechanDown = new NAudio.Wave.WaveChannel32(WavereaderDown);
- volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
- DSODown = new NAudio.Wave.DirectSoundOut();
- DSODown.Init(wavechanDown);
- wavechanDown.Volume = (volumeDown / 100);
- DSODown.Play();
- DSODown.Dispose();
- }
- else
- {
- UI.ShowSubtitle("handbreak.wav" + " is not found!");
- }
- if (handbrake == true )
- {
- Function.Call(Hash.SET_VEHICLE_HANDBRAKE, Game.Player.Character.CurrentVehicle, false);
- handbrake = false;
- } else
- {
- Function.Call(Hash.SET_VEHICLE_HANDBRAKE, Game.Player.Character.CurrentVehicle, true);
- handbrake = true;
- }
- }
- //GEARS
- if (Game.Player.Character.IsInVehicle() && Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "CLUTCH_KEY", Keys.E))
- && Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "NETRUAL_KEY", Keys.N))
- | Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "REVERSE_KEY", Keys.R))
- | Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "FIRST_GEAR_KEY", Keys.D1))
- | Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "SECOND_GEAR_KEY", Keys.D2))
- | Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "THIRD_GEAR_KEY", Keys.D3))
- | Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "FOURTH_GEAR_KEY", Keys.D4))
- | Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "FIFTH_GEAR_KEY", Keys.D5))
- | Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "SIXTH_GEAR_KEY", Keys.D6)))
- {
- Function.Call(Hash.REQUEST_ANIM_DICT, "weapon@w_sp_jerrycan");
- while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, "weapon@w_sp_jerrycan")) Wait(10);
- Game.Player.Character.Task.ClearAll();
- Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character, "weapon@w_sp_jerrycan", "unholster", 12.5f, -5.0f, -1, 48, 0f, 0, 0, 0);
- Wait(400);
- if (File.Exists(@"scripts\EDE\gear.wav"))
- {
- if (!Function.Call<bool>(Hash.IS_PED_ON_ANY_BIKE, Game.Player.Character) && !Function.Call<bool>(Hash.IS_PED_IN_ANY_BOAT, Game.Player.Character) && !Function.Call<bool>(Hash.IS_PED_IN_ANY_HELI, Game.Player.Character) && !Function.Call<bool>(Hash.IS_PED_IN_ANY_PLANE, Game.Player.Character))
- {
- ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\EDE.ini");
- WavereaderDown = new NAudio.Wave.WaveFileReader(@"scripts\EDE\gear.wav");
- wavechanDown = new NAudio.Wave.WaveChannel32(WavereaderDown);
- volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
- DSODown = new NAudio.Wave.DirectSoundOut();
- DSODown.Init(wavechanDown);
- wavechanDown.Volume = (volumeDown / 100);
- DSODown.Play();
- DSODown.Dispose();
- }
- }
- else
- {
- UI.ShowSubtitle("gear.wav" + " is not found!");
- }
- Wait(100);
- Game.Player.Character.Task.ClearAll();
- }
- //SEATBELT
- if (e.Control && Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "SEATBELT_KEY", Keys.Tab)) && Game.Player.Character.IsInVehicle() && !Function.Call<bool>(Hash.IS_PED_ON_ANY_BIKE, Game.Player.Character) && !Function.Call<bool>(Hash.IS_PED_IN_ANY_BOAT, Game.Player.Character) && !Function.Call<bool>(Hash.IS_PED_IN_ANY_HELI, Game.Player.Character) && !Function.Call<bool>(Hash.IS_PED_IN_ANY_PLANE, Game.Player.Character))
- {
- if (seatbelt == false)
- {
- Function.Call(Hash.REQUEST_ANIM_DICT, "oddjobs@basejump@ig_15");
- while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, "oddjobs@basejump@ig_15")) Wait(10);
- Game.Player.Character.Task.ClearAll();
- Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character, "oddjobs@basejump@ig_15", "puton_parachute", 3.3f, -2.0f, -1, 48, 0f, 0, 0, 0);
- Wait(10);
- seatbelt = true;
- UI.Notify("seatbeltOn");
- if (File.Exists(@"scripts\EDE\seatbelt.wav"))
- {
- NAudio.Wave.WaveFileReader WavereaderDown2;
- NAudio.Wave.WaveChannel32 wavechanDown2;
- NAudio.Wave.DirectSoundOut DSODown2;
- ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\EDE.ini");
- WavereaderDown2 = new NAudio.Wave.WaveFileReader(@"scripts\EDE\seatbelt.wav");
- wavechanDown2 = new NAudio.Wave.WaveChannel32(WavereaderDown);
- volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
- DSODown2 = new NAudio.Wave.DirectSoundOut();
- DSODown2.Init(wavechanDown);
- wavechanDown2.Volume = (volumeDown / 100);
- DSODown2.Play();
- DSODown2.Dispose();
- }
- else
- {
- UI.ShowSubtitle("seatbelt.wav" + " is not found!");
- }
- }
- else
- {
- Function.Call(Hash.REQUEST_ANIM_DICT, "move_action@p_m_one@holster");
- while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, "move_action@p_m_one@holster")) Wait(10);
- Game.Player.Character.Task.ClearAll();
- Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character, "move_action@p_m_one@holster", "1h_holster_unarmed", 3.3f, -2.0f, -1, 48, 0f, 0, 0, 0);
- Wait(10);
- seatbelt = false;
- UI.Notify("seatbeltFalse");
- if (File.Exists(@"scripts\EDE\seatbelt.wav"))
- {
- NAudio.Wave.WaveFileReader WavereaderDown;
- NAudio.Wave.WaveChannel32 wavechanDown;
- NAudio.Wave.DirectSoundOut DSODown;
- ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\EDE.ini");
- WavereaderDown = new NAudio.Wave.WaveFileReader(@"scripts\EDE\seatbelt.wav");
- wavechanDown = new NAudio.Wave.WaveChannel32(WavereaderDown);
- volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
- DSODown = new NAudio.Wave.DirectSoundOut();
- DSODown.Init(wavechanDown);
- wavechanDown.Volume = (volumeDown / 100);
- DSODown.Play();
- DSODown.Dispose();
- }
- else
- {
- UI.ShowSubtitle("seatbelt.wav" + " is not found!");
- }
- }
- }
- //ENGINE
- if (e.Control && Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "ENGINE_KEY", Keys.C)) && Game.Player.Character.IsInVehicle())
- {
- //Function.Call(Hash.REQUEST_ANIM_DICT, "veh@van@ds@base");
- //while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, "veh@van@ds@base")) Wait(10);
- if (Game.Player.Character.CurrentVehicle.EngineRunning == true)
- {
- //Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character, "veh@van@ds@base", "start_engine", 2.0f, -1.0f, -1, 48, 0f, 0, 0, 0);
- if (File.Exists(@"scripts\EDE\engine.wav"))
- {
- ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\bca.ini");
- WavereaderDown = new NAudio.Wave.WaveFileReader(@"scripts\EDE\engine.wav");
- wavechanDown = new NAudio.Wave.WaveChannel32(WavereaderDown);
- volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
- DSODown = new NAudio.Wave.DirectSoundOut();
- DSODown.Init(wavechanDown);
- wavechanDown.Volume = (volumeDown / 100);
- DSODown.Play();
- DSODown.Dispose();
- }
- else
- {
- UI.ShowSubtitle("engine.wav" + " is not found!");
- }
- // UI.Notify("Engine-OFF");
- // engineStat = false;
- Game.Player.Character.Task.ClearAll();
- Function.Call(Hash.SET_VEHICLE_ENGINE_ON, Game.Player.Character.CurrentVehicle, false, false);
- // Game.Player.Character.CurrentVehicle.EngineRunning = false;
- }
- else
- if (Game.Player.Character.CurrentVehicle.EngineRunning == false)
- {
- //Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character, "veh@van@ds@base", "start_engine", 2.0f, -1.0f, -1, 48, 0f, 0, 0, 0);
- if (File.Exists(@"scripts\EDE\engine.wav"))
- {
- ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\bca.ini");
- WavereaderDown = new NAudio.Wave.WaveFileReader(@"scripts\EDE\engine.wav");
- wavechanDown = new NAudio.Wave.WaveChannel32(WavereaderDown);
- volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
- DSODown = new NAudio.Wave.DirectSoundOut();
- DSODown.Init(wavechanDown);
- wavechanDown.Volume = (volumeDown / 100);
- DSODown.Play();
- DSODown.Dispose();
- }
- else
- {
- UI.ShowSubtitle("engine.wav" + " is not found!");
- }
- // UI.Notify("Engine-ON");
- // engineStat = true;
- Game.Player.Character.Task.ClearAll();
- Function.Call(Hash.SET_VEHICLE_ENGINE_ON, Game.Player.Character.CurrentVehicle, true, false);
- // Game.Player.Character.CurrentVehicle.EngineRunning = true;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement