Advertisement
Guest User

SlowMoBT - Keyboard - Updated

a guest
May 28th, 2017
227
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using GTA; // This is a reference that is needed! do not edit this
  2. using GTA.Native; // This is a reference that is needed! do not edit this
  3. using System; // This is a reference that is needed! do not edit this
  4. using System.Windows.Forms; // This is a reference that is needed! do not edit this
  5.  
  6. namespace SlomoBT
  7. {
  8.     public class SlomoBT : Script // declare Modname as a script
  9.     {
  10.         bool toggle = false;
  11.         bool toggle2 = false;
  12.         public SlomoBT() // main function
  13.         {
  14.             Tick += this.OnTick;
  15.             KeyDown += this.OnKeyDown;
  16.             KeyUp += this.OnKeyUp;
  17.             Interval = 1;
  18.         }
  19.  
  20.         void OnTick(object sender, EventArgs e) // This is where most of your script goes
  21.         {
  22.             Ped player = Game.Player.Character; // player variable
  23.             Vehicle veh = Game.Player.Character.CurrentVehicle; // vehicle variable
  24.             bool invehicle = Function.Call<bool>(Hash.IS_PED_SITTING_IN_ANY_VEHICLE, player);
  25.            
  26.             //In the next line, change "Menu" to any other key you want to use.
  27.             //Available Keys: https://msdn.microsoft.com/en-us/library/system.windows.forms.keys(v=vs.110).aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-1
  28.             //Default is "Menu", which is the ALT key.
  29.             if (Game.IsKeyPressed(Keys.Menu) && Game.CurrentInputMode == InputMode.MouseAndKeyboard)
  30.             {
  31.                 if (toggle)
  32.                 {
  33.                     toggle = false;
  34.                     UI.ShowSubtitle("Bullet Time OFF");
  35.                     GTA.Native.Function.Call(Hash.SET_TIME_SCALE, 1.0f); //return to normal speed when script is OFF
  36.                     Wait(300);
  37.                 }
  38.                 else if (!toggle)
  39.                 {
  40.                     toggle = true;
  41.                     UI.ShowSubtitle("Bullet Time ON");
  42.                     GTA.Native.Function.Call(Hash.SET_TIME_SCALE, 0.25f); //How slow the game will be when the script is enabled (Default = 25% of normal speed)
  43.                     Wait(300);
  44.                 }
  45.             }
  46.            
  47.             if (toggle)
  48.             {
  49.                 if (invehicle)
  50.                 {
  51.                     if (Game.Player.IsAiming)
  52.                     {
  53.                         GTA.Native.Function.Call(Hash.SET_TIME_SCALE, 0.2f); //How slow the game will be when the script is enabled and you are aiming while in a vehicle (Default = 20% of normal speed)
  54.                     }
  55.                     else
  56.                     {
  57.                         GTA.Native.Function.Call(Hash.SET_TIME_SCALE, 1.0f); //return to normal speed when script is ON while in a vehicle and you are NOT aiming
  58.                     }
  59.                 }
  60.                 else
  61.                 {
  62.                     if (Game.Player.IsAiming)
  63.                     {
  64.                         GTA.Native.Function.Call(Hash.SET_TIME_SCALE, 0.25f); //How slow the game will be when the script is enabled and you are aiming (Default = 25% of normal speed)
  65.                     }
  66.                     else
  67.                     {
  68.                         GTA.Native.Function.Call(Hash.SET_TIME_SCALE, 1.0f); //return to normal speed when script is ON and you are NOT aiming
  69.                     }
  70.                 }
  71.             }
  72.         }
  73.  
  74.         void OnKeyDown(object sender, KeyEventArgs e)
  75.         {
  76.         }
  77.  
  78.         void OnKeyUp(object sender, KeyEventArgs e)
  79.         {
  80.         }
  81.     }
  82. }
Advertisement
RAW Paste Data Copied
Advertisement