Advertisement
Guest User

SlowMo - Gamepad - Updated

a guest
May 28th, 2017
290
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.             if (Game.IsControlPressed(2, GTA.Control.Aim)) //Turn on script with Aim key + Dpad Down
  26.             {
  27.                 Game.DisableControl(2, GTA.Control.Phone);
  28.                 if ((Game.IsControlPressed(2, GTA.Control.PhoneDown) && Game.CurrentInputMode == InputMode.GamePad))// || (Game.IsControlPressed(2, GTA.Control.Phone) && Game.CurrentInputMode == InputMode.MouseAndKeyboard))
  29.                 {
  30.                     if (toggle)
  31.                     {
  32.                         toggle = false;
  33.                         GTA.Native.Function.Call(Hash.SET_TIME_SCALE, 1.0f); //return to normal speed when script is OFF
  34.                         Wait(300);
  35.                     }
  36.                     else if (!toggle)
  37.                     {
  38.                         toggle = true;
  39.                         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)
  40.                         Wait(300);
  41.                     }
  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