Advertisement
Guest User

SlowMo - Keyboard - Updated

a guest
May 28th, 2017
234
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 SloMo
  7. {
  8.     public class SloMo : Script // declare Modname as a script
  9.     {
  10.         bool toggle = false;
  11.         bool toggle2 = false;
  12.         public SloMo() // 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.                         GTA.Native.Function.Call(Hash.SET_TIME_SCALE, 1.0f); //return to normal speed when script is OFF
  35.                         Wait(300);
  36.                     }
  37.                     else if (!toggle)
  38.                     {
  39.                         toggle = true;
  40.                         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)
  41.                         Wait(300);
  42.                     }
  43.             }
  44.            
  45.             if (toggle)
  46.             {
  47.                 if (invehicle)
  48.                 {
  49.                     GTA.Native.Function.Call(Hash.SET_TIME_SCALE, 0.2f); //How slow the game will be when the script is enabled while in a vehicle (Default = 20% of normal speed)
  50.                 }
  51.                 else
  52.                 {
  53.                     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)
  54.                 }
  55.             }
  56.         }
  57.  
  58.         void OnKeyDown(object sender, KeyEventArgs e)
  59.         {
  60.         }
  61.  
  62.         void OnKeyUp(object sender, KeyEventArgs e)
  63.         {
  64.         }
  65.     }
  66. }
Advertisement
RAW Paste Data Copied
Advertisement