Advertisement
Guest User

EnhancedDrivingExperience

a guest
Feb 18th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 30.11 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows.Forms;
  7. using GTA;
  8. using GTA.Native;
  9. using GTA.Math;
  10. using NativeUI;
  11. using System.IO;
  12. using System.Drawing;
  13.  
  14. namespace EnhancedDrivingExperience
  15. {
  16.  
  17.     public class EnhancedDrivingExperience : Script
  18.     {
  19.         ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\EDE.ini");
  20.        // private bool lights;
  21.        // private bool engineStat;
  22.         private bool indicatorLeft;
  23.         private bool indicatorRight;
  24.         private bool windowStat;
  25.         private bool seatbelt = false;
  26.         private bool handbrake;
  27.         private bool handIdle;
  28.         private bool hazardLights;
  29.         NAudio.Wave.WaveFileReader WavereaderDown;
  30.         NAudio.Wave.WaveChannel32 wavechanDown;
  31.         NAudio.Wave.DirectSoundOut DSODown;
  32.         float volumeDown;
  33.         public EnhancedDrivingExperience()
  34.         {
  35.             Tick += OnTick;
  36.             KeyDown += OnKeyDown;
  37.             KeyUp += OnKeyUP;
  38.         }
  39.         private void OnKeyUP(object sender, KeyEventArgs e)
  40.         {
  41.  
  42.         }
  43.         private void OnTick(object sender, EventArgs e)
  44.         {
  45.             //LIGHTS
  46.  
  47.            //  if (Game.Player.Character.CurrentVehicle.EngineRunning == false & Game.Player.Character.LastVehicle.EngineRunning == false) {
  48.            //      Function.Call(Hash.SET_VEHICLE_LIGHTS, Game.Player.Character.CurrentVehicle, 0);
  49.            //     lights = false;
  50.  
  51.  
  52.            // }
  53.             //if (lights == true)
  54.            // {
  55.             //    Function.Call(Hash.SET_VEHICLE_LIGHTS, Game.Player.Character.CurrentVehicle, 2);
  56.            // }
  57.            // else
  58.            // {
  59.            //     Function.Call(Hash.SET_VEHICLE_LIGHTS, Game.Player.Character.CurrentVehicle, 0);
  60.            // }
  61.  
  62.             //WINDOWSTAT
  63.  
  64.             if (!Function.Call<bool>(Hash.IS_VEHICLE_WINDOW_INTACT, Game.Player.Character.CurrentVehicle,0))
  65.                 {
  66.                     //windowStat = true;
  67.                 }
  68.  
  69.  
  70.                
  71.  
  72.             if (!Game.Player.Character.IsInVehicle())
  73.                 {
  74.                     seatbelt = false;
  75.                     handIdle = false;
  76.                     windowStat = false;
  77.                     handbrake = false;
  78.                 }
  79.  
  80.             //SEATBELT
  81.  
  82.             if (seatbelt == true) {
  83.                 Function.Call(Hash.SET_PED_CONFIG_FLAG, Game.Player.Character, 32, false);
  84.             } else
  85.             {
  86.                 Function.Call(Hash.SET_PED_CONFIG_FLAG, Game.Player.Character, 32, true);
  87.             }
  88.             if (Game.Player.Character.IsInVehicle() && seatbelt == false && !Function.Call<bool>(Hash.IS_CUTSCENE_ACTIVE))
  89.             {
  90.                 float x = config.GetValue<float>("Settings", "x", 190f);
  91.                 int xf = (int)x;
  92.                 float y = config.GetValue<float>("Settings", "y", 640f);
  93.                 int yf = (int)y;
  94.                 float Width = config.GetValue<float>("Settings", "Width", 50f);
  95.                 int Widthf = (int)Width;
  96.                 float Height = config.GetValue<float>("Settings", "Height", 50f);
  97.                 int Heightf = (int)Height;
  98.                 if (config.GetValue<bool>("SETTINGS", "ICON_DRAW", true))
  99.                 {
  100.                     GTA.UI.DrawTexture(".\\Scripts\\EDE\\chime.png", 0, 1, 1500, new Point(xf, yf), new Size(Widthf, Heightf));
  101.                 }
  102.  
  103.             }
  104.  
  105.             //handIdle
  106.  
  107.             if (handIdle == true && Game.Player.Character.IsInVehicle())
  108.             {
  109.                 windowStat = true;
  110.             }
  111.  
  112.                 if (windowStat == true && Game.Player.Character.IsInVehicle())
  113.             {
  114.                 Function.Call(Hash.ROLL_DOWN_WINDOW, Game.Player.Character.CurrentVehicle, 0);
  115.             } else
  116.             {
  117.                 Function.Call(Hash.ROLL_UP_WINDOW, Game.Player.Character.CurrentVehicle, 0);
  118.             }
  119.  
  120.             //Handbrake
  121.  
  122.             if (handbrake == true && Game.Player.Character.IsInVehicle())
  123.             {
  124.                 Function.Call(Hash.SET_VEHICLE_HANDBRAKE, Game.Player.Character.CurrentVehicle, true);
  125.             }
  126.             else
  127.             {
  128.                 Function.Call(Hash.SET_VEHICLE_HANDBRAKE, Game.Player.Character.CurrentVehicle, false);
  129.             }  
  130.         }
  131.         private void OnKeyDown(object sender, KeyEventArgs e)
  132.         {
  133.             //HANDIDLE
  134.            
  135.  
  136.             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))
  137.             {
  138.                 if (handIdle == false && windowStat == true)
  139.                 {
  140.                     Function.Call(Hash.REQUEST_ANIM_DICT, "anim@veh@lowrider@std@ds@arm@base");
  141.                     while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, "anim@veh@lowrider@std@ds@arm@base")) Wait(10);
  142.                     Game.Player.Character.Task.ClearAll();
  143.                     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);
  144.                     handIdle = true;
  145.                 } else
  146.                 {
  147.                     Game.Player.Character.Task.ClearAll();
  148.                     handIdle = false;
  149.                 }
  150.             }
  151.  
  152.             //LIGHTS
  153.  
  154.             if (Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "LEFT_INDICATOR_KEY", Keys.Q))  && Game.Player.Character.IsInVehicle() && Game.Player.Character.CurrentVehicle.EngineRunning == true)
  155.             {
  156.                 Function.Call(Hash.REQUEST_ANIM_DICT, "weapons@pistol@");
  157.                 while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, "weapons@pistol@")) Wait(10);
  158.                 Game.Player.Character.Task.ClearAll();
  159.                 Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character, "weapons@pistol@", "walk", 33.1f, -2.1f, -1, 48, 0f, 0, 0, 0);
  160.                 Wait(300);
  161.                 Game.Player.Character.Task.ClearAll();
  162.                 if (File.Exists(@"scripts\EDE\indicator.wav"))
  163.                 {
  164.                     ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\EDE.ini");
  165.                     WavereaderDown = new NAudio.Wave.WaveFileReader(@"scripts\EDE\indicator.wav");
  166.                     wavechanDown = new NAudio.Wave.WaveChannel32(WavereaderDown);
  167.                     volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
  168.                     DSODown = new NAudio.Wave.DirectSoundOut();
  169.                     DSODown.Init(wavechanDown);
  170.                     wavechanDown.Volume = (volumeDown / 100);
  171.                     DSODown.Play();
  172.                     DSODown.Dispose();
  173.  
  174.                 }
  175.  
  176.                 else
  177.                 {
  178.                     UI.ShowSubtitle("indicator.wav" + " is not found!");
  179.  
  180.                 }
  181.                 if (indicatorLeft == true)
  182.                 {
  183.                     Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 0, false);
  184.                     Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 1, false);
  185.                     indicatorLeft = false;
  186.                     indicatorRight = false;
  187.                 }
  188.                 else
  189.                 {
  190.                     Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 0, false);
  191.                     Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 1, true);
  192.                     indicatorLeft = true;
  193.                     indicatorRight = false;
  194.                 }            
  195.             }
  196.             if (Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "RIGHT_INDICATOR_KEY", Keys.T)) && Game.Player.Character.IsInVehicle() && Game.Player.Character.CurrentVehicle.EngineRunning == true)
  197.             {
  198.                 Function.Call(Hash.REQUEST_ANIM_DICT, "weapons@pistol@");
  199.                 while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, "weapons@pistol@")) Wait(10);
  200.                 Game.Player.Character.Task.ClearAll();
  201.                 Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character, "weapons@pistol@", "walk", 33.1f, -2.1f, -1, 48, 0f, 0, 0, 0);
  202.                 Wait(300);
  203.                 Game.Player.Character.Task.ClearAll();
  204.                 if (File.Exists(@"scripts\EDE\indicator.wav"))
  205.                 {
  206.                     ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\EDE.ini");
  207.                     WavereaderDown = new NAudio.Wave.WaveFileReader(@"scripts\EDE\indicator.wav");
  208.                     wavechanDown = new NAudio.Wave.WaveChannel32(WavereaderDown);
  209.                     volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
  210.                     DSODown = new NAudio.Wave.DirectSoundOut();
  211.                     DSODown.Init(wavechanDown);
  212.                     wavechanDown.Volume = (volumeDown / 100);
  213.                     DSODown.Play();
  214.                     DSODown.Dispose();
  215.  
  216.                 }
  217.  
  218.                 else
  219.                 {
  220.                     UI.ShowSubtitle("indicator.wav" + " is not found!");
  221.  
  222.                 }
  223.                 if (indicatorRight == true)
  224.                 {
  225.                     Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 0, false);
  226.                     Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 1, false);
  227.                     indicatorLeft = false;
  228.                     indicatorRight = false;
  229.                 }
  230.                 else
  231.                 {
  232.                     Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 1, false);
  233.                     Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 0, true);
  234.                     indicatorLeft = false;
  235.                     indicatorRight = true;
  236.                 }
  237.                
  238.             }
  239.             if (Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "HAZARD_LIGHTS_KEY", Keys.U)) && Game.Player.Character.IsInVehicle() && Game.Player.Character.CurrentVehicle.EngineRunning == true)
  240.             {
  241.                 Function.Call(Hash.REQUEST_ANIM_DICT, "weapons@pistol@");
  242.                 while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, "weapons@pistol@")) Wait(10);
  243.                 Game.Player.Character.Task.ClearAll();
  244.                 Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character, "weapons@pistol@", "walk", 33.1f, -2.1f, -1, 48, 0f, 0, 0, 0);
  245.                 Wait(300);
  246.                 Game.Player.Character.Task.ClearAll();
  247.                 if (File.Exists(@"scripts\EDE\indicator.wav"))
  248.                 {
  249.                     ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\EDE.ini");
  250.                     WavereaderDown = new NAudio.Wave.WaveFileReader(@"scripts\EDE\indicator.wav");
  251.                     wavechanDown = new NAudio.Wave.WaveChannel32(WavereaderDown);
  252.                     volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
  253.                     DSODown = new NAudio.Wave.DirectSoundOut();
  254.                     DSODown.Init(wavechanDown);
  255.                     wavechanDown.Volume = (volumeDown / 100);
  256.                     DSODown.Play();
  257.                     DSODown.Dispose();
  258.  
  259.                 }
  260.  
  261.                 else
  262.                 {
  263.                     UI.ShowSubtitle("indicator.wav" + " is not found!");
  264.  
  265.                 }
  266.                 if (hazardLights == true)
  267.                 {
  268.                     Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 0, false);
  269.                     Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 1, false);
  270.                     indicatorLeft = false;
  271.                     indicatorRight = false;
  272.                     hazardLights = false;
  273.                 }
  274.                 else
  275.                 {
  276.                     Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 0, true);
  277.                     Function.Call(Hash.SET_VEHICLE_INDICATOR_LIGHTS, Game.Player.Character.CurrentVehicle, 1, true);
  278.                     indicatorLeft = true;
  279.                     indicatorRight = true;
  280.                     hazardLights = true;
  281.                 }
  282.             }
  283.             if (Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "LIGHTS_KEY", Keys.L)) && Game.Player.Character.IsInVehicle() && Game.Player.Character.CurrentVehicle.EngineRunning == true)
  284.             {
  285.  
  286.                 Function.Call(Hash.REQUEST_ANIM_DICT, "weapons@pistol@");
  287.                 while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, "weapons@pistol@")) Wait(10);
  288.                 Game.Player.Character.Task.ClearAll();
  289.                 Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character, "weapons@pistol@", "walk", 33.1f, -2.1f, -1, 48, 0f, 0, 0, 0);
  290.                 Wait(300);
  291.                 Game.Player.Character.Task.ClearAll();
  292.                 if (File.Exists(@"scripts\EDE\indicator.wav"))
  293.                 {
  294.                     ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\EDE.ini");
  295.                     WavereaderDown = new NAudio.Wave.WaveFileReader(@"scripts\EDE\indicator.wav");
  296.                     wavechanDown = new NAudio.Wave.WaveChannel32(WavereaderDown);
  297.                     volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
  298.                     DSODown = new NAudio.Wave.DirectSoundOut();
  299.                     DSODown.Init(wavechanDown);
  300.                     wavechanDown.Volume = (volumeDown / 100);
  301.                     DSODown.Play();
  302.                     DSODown.Dispose();
  303.  
  304.                 }
  305.  
  306.                 else
  307.                 {
  308.                     UI.ShowSubtitle("indicator.wav" + " is not found!");
  309.  
  310.                 }
  311.                // if (lights == false)
  312.                // {
  313.                //     Function.Call(Hash.SET_VEHICLE_LIGHTS, Game.Player.Character.CurrentVehicle, 2);
  314.               //      lights = true;
  315.                // } else
  316.                // {
  317.                //     Function.Call(Hash.SET_VEHICLE_LIGHTS, Game.Player.Character.CurrentVehicle, 0);
  318.                //     lights = false;
  319.               //  }
  320.             }
  321.  
  322.             //WINDOW
  323.  
  324.             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))
  325.             {
  326.                 Function.Call(Hash.REQUEST_ANIM_DICT, "weapons@pistol@");
  327.                 while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, "weapons@pistol@")) Wait(10);
  328.                 Game.Player.Character.Task.ClearAll();
  329.                 if (windowStat == false)
  330.                 {
  331.                     Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character, "weapons@pistol@", "walk", 2.1f, -2.1f, -1, 48, 0f, 0, 0, 0);
  332.                     Wait(300);
  333.                     Game.Player.Character.Task.ClearAll();
  334.                     Function.Call(Hash.ROLL_DOWN_WINDOW, Game.Player.Character.CurrentVehicle, 0);
  335.                     if (File.Exists(@"scripts\EDE\window.wav"))
  336.                     {
  337.                         ScriptSettings config = ScriptSettings.Load(@"scripts\bca\EDE.ini");
  338.                         WavereaderDown = new NAudio.Wave.WaveFileReader(@"scripts\EDE\window.wav");
  339.                         wavechanDown = new NAudio.Wave.WaveChannel32(WavereaderDown);
  340.                         volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
  341.                         DSODown = new NAudio.Wave.DirectSoundOut();
  342.                         DSODown.Init(wavechanDown);
  343.                         wavechanDown.Volume = (volumeDown / 100);
  344.                         DSODown.Play();
  345.                         DSODown.Dispose();
  346.  
  347.                     }
  348.  
  349.                     else
  350.                     {
  351.                         UI.ShowSubtitle("window.wav" + " is not found!");
  352.  
  353.                     }
  354.                     windowStat = true;
  355.                 } else if (windowStat == true)
  356.                 {
  357.                     Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character, "weapons@pistol@", "walk", 2.1f, -2.1f, -1, 48, 0f, 0, 0, 0);
  358.                     Wait(300);
  359.                     Game.Player.Character.Task.ClearAll();
  360.                     Function.Call(Hash.ROLL_UP_WINDOW, Game.Player.Character.CurrentVehicle, 0);
  361.                     if (File.Exists(@"scripts\EDE\window.wav"))
  362.                     {
  363.                         ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\EDE.ini");
  364.                         WavereaderDown = new NAudio.Wave.WaveFileReader(@"scripts\EDE\window.wav");
  365.                         wavechanDown = new NAudio.Wave.WaveChannel32(WavereaderDown);
  366.                         volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
  367.                         DSODown = new NAudio.Wave.DirectSoundOut();
  368.                         DSODown.Init(wavechanDown);
  369.                         wavechanDown.Volume = (volumeDown / 100);
  370.                         DSODown.Play();
  371.                         DSODown.Dispose();
  372.                     }
  373.                     else
  374.                     {
  375.                         UI.ShowSubtitle("window.wav" + " is not found!");
  376.  
  377.                     }
  378.                     windowStat = false;
  379.  
  380.                 }
  381.             }
  382.  
  383.             //HANDBREAK
  384.             //Game.Player.Character.IsStopped &&
  385.  
  386.             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))
  387.             {
  388.                 //UI.Notify("Handbreak");
  389.                 Function.Call(Hash.REQUEST_ANIM_DICT, "weapon@w_sp_jerrycan");
  390.                 while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, "weapon@w_sp_jerrycan")) Wait(10);
  391.                 Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character, "weapon@w_sp_jerrycan", "unholster", 45.5f, -6.0f, -1, 48, 0f, 0, 0, 0);
  392.                 Wait(390);
  393.                 if (File.Exists(@"scripts\EDE\handbreak.wav"))
  394.                 {
  395.                     ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\EDE.ini");
  396.                     WavereaderDown = new NAudio.Wave.WaveFileReader(@"scripts\EDE\handbreak.wav");
  397.                     wavechanDown = new NAudio.Wave.WaveChannel32(WavereaderDown);
  398.                     volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
  399.                     DSODown = new NAudio.Wave.DirectSoundOut();
  400.                     DSODown.Init(wavechanDown);
  401.                     wavechanDown.Volume = (volumeDown / 100);
  402.                     DSODown.Play();
  403.                     DSODown.Dispose();
  404.  
  405.                 }
  406.  
  407.                 else
  408.                 {
  409.                     UI.ShowSubtitle("handbreak.wav" + " is not found!");
  410.  
  411.                 }
  412.                 if (handbrake == true )
  413.                 {
  414.                     Function.Call(Hash.SET_VEHICLE_HANDBRAKE, Game.Player.Character.CurrentVehicle, false);
  415.                     handbrake = false;
  416.                 } else
  417.                 {
  418.                     Function.Call(Hash.SET_VEHICLE_HANDBRAKE, Game.Player.Character.CurrentVehicle, true);
  419.                     handbrake = true;
  420.                 }
  421.             }
  422.  
  423.             //GEARS
  424.  
  425.             if (Game.Player.Character.IsInVehicle() && Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "CLUTCH_KEY", Keys.E))  
  426.                 && Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "NETRUAL_KEY", Keys.N))
  427.                 | Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "REVERSE_KEY", Keys.R))
  428.                 | Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "FIRST_GEAR_KEY", Keys.D1))
  429.                 | Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "SECOND_GEAR_KEY", Keys.D2))
  430.                 | Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "THIRD_GEAR_KEY", Keys.D3))
  431.                 | Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "FOURTH_GEAR_KEY", Keys.D4))
  432.                 | Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "FIFTH_GEAR_KEY", Keys.D5))
  433.                 | Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "SIXTH_GEAR_KEY", Keys.D6)))
  434.             {
  435.                 Function.Call(Hash.REQUEST_ANIM_DICT, "weapon@w_sp_jerrycan");
  436.                 while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, "weapon@w_sp_jerrycan")) Wait(10);
  437.                 Game.Player.Character.Task.ClearAll();
  438.                 Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character, "weapon@w_sp_jerrycan", "unholster", 12.5f, -5.0f, -1, 48, 0f, 0, 0, 0);
  439.                 Wait(400);
  440.                 if (File.Exists(@"scripts\EDE\gear.wav"))
  441.                 {
  442.                     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))
  443.                     {
  444.                         ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\EDE.ini");
  445.                         WavereaderDown = new NAudio.Wave.WaveFileReader(@"scripts\EDE\gear.wav");
  446.                         wavechanDown = new NAudio.Wave.WaveChannel32(WavereaderDown);
  447.                         volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
  448.                         DSODown = new NAudio.Wave.DirectSoundOut();
  449.                         DSODown.Init(wavechanDown);
  450.                         wavechanDown.Volume = (volumeDown / 100);
  451.                         DSODown.Play();
  452.                         DSODown.Dispose();
  453.  
  454.                     }
  455.  
  456.                 }
  457.  
  458.                 else
  459.                 {
  460.                     UI.ShowSubtitle("gear.wav" + " is not found!");
  461.  
  462.                 }
  463.                 Wait(100);
  464.                 Game.Player.Character.Task.ClearAll();
  465.  
  466.             }
  467.  
  468.             //SEATBELT
  469.  
  470.  
  471.  
  472.             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))
  473.             {
  474.                 if (seatbelt == false)
  475.                 {
  476.                     Function.Call(Hash.REQUEST_ANIM_DICT, "oddjobs@basejump@ig_15");
  477.                     while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, "oddjobs@basejump@ig_15")) Wait(10);
  478.                     Game.Player.Character.Task.ClearAll();
  479.                     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);
  480.                     Wait(10);
  481.                     seatbelt = true;
  482.                     UI.Notify("seatbeltOn");
  483.                     if (File.Exists(@"scripts\EDE\seatbelt.wav"))
  484.                     {
  485.                         NAudio.Wave.WaveFileReader WavereaderDown2;
  486.                         NAudio.Wave.WaveChannel32 wavechanDown2;
  487.                         NAudio.Wave.DirectSoundOut DSODown2;
  488.                         ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\EDE.ini");
  489.                         WavereaderDown2 = new NAudio.Wave.WaveFileReader(@"scripts\EDE\seatbelt.wav");
  490.                         wavechanDown2 = new NAudio.Wave.WaveChannel32(WavereaderDown);
  491.                         volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
  492.                         DSODown2 = new NAudio.Wave.DirectSoundOut();
  493.                         DSODown2.Init(wavechanDown);
  494.                         wavechanDown2.Volume = (volumeDown / 100);
  495.                         DSODown2.Play();
  496.                         DSODown2.Dispose();
  497.                     }
  498.  
  499.                     else
  500.                     {
  501.                         UI.ShowSubtitle("seatbelt.wav" + " is not found!");
  502.  
  503.                     }
  504.  
  505.                 }
  506.                 else
  507.                 {
  508.                     Function.Call(Hash.REQUEST_ANIM_DICT, "move_action@p_m_one@holster");
  509.                     while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, "move_action@p_m_one@holster")) Wait(10);
  510.                     Game.Player.Character.Task.ClearAll();
  511.                     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);
  512.                     Wait(10);
  513.                     seatbelt = false;
  514.                     UI.Notify("seatbeltFalse");
  515.                     if (File.Exists(@"scripts\EDE\seatbelt.wav"))
  516.                     {
  517.                         NAudio.Wave.WaveFileReader WavereaderDown;
  518.                         NAudio.Wave.WaveChannel32 wavechanDown;
  519.                         NAudio.Wave.DirectSoundOut DSODown;
  520.                         ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\EDE.ini");
  521.                         WavereaderDown = new NAudio.Wave.WaveFileReader(@"scripts\EDE\seatbelt.wav");
  522.                         wavechanDown = new NAudio.Wave.WaveChannel32(WavereaderDown);
  523.                         volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
  524.                         DSODown = new NAudio.Wave.DirectSoundOut();
  525.                         DSODown.Init(wavechanDown);
  526.                         wavechanDown.Volume = (volumeDown / 100);
  527.                         DSODown.Play();
  528.                         DSODown.Dispose();
  529.                     }
  530.  
  531.                     else
  532.                     {
  533.                         UI.ShowSubtitle("seatbelt.wav" + " is not found!");
  534.  
  535.                     }
  536.                 }
  537.             }
  538.  
  539.  
  540.             //ENGINE
  541.  
  542.             if (e.Control && Game.IsKeyPressed(config.GetValue<Keys>("KEYS", "ENGINE_KEY", Keys.C)) && Game.Player.Character.IsInVehicle())
  543.             {
  544.                 //Function.Call(Hash.REQUEST_ANIM_DICT, "veh@van@ds@base");
  545.                 //while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, "veh@van@ds@base")) Wait(10);
  546.                 if (Game.Player.Character.CurrentVehicle.EngineRunning == true)
  547.                 {
  548.                     //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);
  549.  
  550.                     if (File.Exists(@"scripts\EDE\engine.wav"))
  551.                     {
  552.                         ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\bca.ini");
  553.                         WavereaderDown = new NAudio.Wave.WaveFileReader(@"scripts\EDE\engine.wav");
  554.                         wavechanDown = new NAudio.Wave.WaveChannel32(WavereaderDown);
  555.                         volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
  556.                         DSODown = new NAudio.Wave.DirectSoundOut();
  557.                         DSODown.Init(wavechanDown);
  558.                         wavechanDown.Volume = (volumeDown / 100);
  559.                         DSODown.Play();
  560.                         DSODown.Dispose();
  561.  
  562.                     }
  563.  
  564.                     else
  565.                     {
  566.                         UI.ShowSubtitle("engine.wav" + " is not found!");
  567.  
  568.                     }
  569.                     // UI.Notify("Engine-OFF");
  570.                     // engineStat = false;
  571.                     Game.Player.Character.Task.ClearAll();
  572.                     Function.Call(Hash.SET_VEHICLE_ENGINE_ON, Game.Player.Character.CurrentVehicle, false, false);
  573.                     // Game.Player.Character.CurrentVehicle.EngineRunning = false;
  574.                 }
  575.                 else
  576.                 if (Game.Player.Character.CurrentVehicle.EngineRunning == false)
  577.                 {
  578.                     //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);
  579.                     if (File.Exists(@"scripts\EDE\engine.wav"))
  580.                     {
  581.                         ScriptSettings config = ScriptSettings.Load(@"scripts\EDE\bca.ini");
  582.                         WavereaderDown = new NAudio.Wave.WaveFileReader(@"scripts\EDE\engine.wav");
  583.                         wavechanDown = new NAudio.Wave.WaveChannel32(WavereaderDown);
  584.                         volumeDown = config.GetValue<float>("Settings", "Global Volume Down", 30f);
  585.                         DSODown = new NAudio.Wave.DirectSoundOut();
  586.                         DSODown.Init(wavechanDown);
  587.                         wavechanDown.Volume = (volumeDown / 100);
  588.                         DSODown.Play();
  589.                         DSODown.Dispose();
  590.  
  591.                     }
  592.  
  593.                     else
  594.                     {
  595.                         UI.ShowSubtitle("engine.wav" + " is not found!");
  596.  
  597.                     }
  598.                     // UI.Notify("Engine-ON");
  599.                     // engineStat = true;
  600.                     Game.Player.Character.Task.ClearAll();
  601.                     Function.Call(Hash.SET_VEHICLE_ENGINE_ON, Game.Player.Character.CurrentVehicle, true, false);
  602.                     // Game.Player.Character.CurrentVehicle.EngineRunning = true;
  603.  
  604.                 }
  605.             }
  606.  
  607.  
  608.         }
  609.  
  610.     }
  611. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement