Advertisement
Guest User

SpecialGodmodeQuickToggle

a guest
May 16th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.69 KB | None | 0 0
  1. using GTA; // This is a reference that is needed! do not edit this
  2. using GTA.Math;
  3. using GTA.Native; // This is a reference that is needed! do not edit this
  4. using System; // This is a reference that is needed! do not edit this
  5. using System.Windows.Forms; // This is a reference that is needed! do not edit this
  6.  
  7. namespace PersonalToggles
  8. {
  9.     public class PersonalToggles : Script // declare Modname as a script
  10.     {
  11.         bool invincible = false;
  12.         int maxHealth = 500;
  13.  
  14.         public PersonalToggles() // main function
  15.         {
  16.             Tick += this.OnTick;
  17.             KeyDown += this.OnKeyDown;
  18.             KeyUp += this.OnKeyUp;
  19.         }
  20.  
  21.         void OnTick(object sender, EventArgs e) // This is where most of your script goes
  22.         {
  23.             Ped player = Game.Player.Character; // player variable
  24.  
  25.             //Turn on Special Godmode with X + Dpad Down
  26.             if (Game.IsControlPressed(2, GTA.Control.Sprint) && Game.IsControlPressed(2, GTA.Control.PhoneDown))
  27.             {
  28.                 if (!invincible)
  29.                 {
  30.                     invincible = true;
  31.                     player.MaxHealth = maxHealth;
  32.                     Function.Call(Hash._SET_NOTIFICATION_TEXT_ENTRY, "STRING");
  33.                     Function.Call(Hash._ADD_TEXT_COMPONENT_STRING, "Player Invincibility: ~g~On~g~");
  34.                     Function.Call(Hash._DRAW_NOTIFICATION, 0, 0);
  35.                     Wait(200);
  36.                 }
  37.                 else if (invincible)
  38.                 {
  39.                     invincible = false;
  40.                     player.IsInvincible = false;
  41.                     Function.Call(Hash._SET_NOTIFICATION_TEXT_ENTRY, "STRING");
  42.                     Function.Call(Hash._ADD_TEXT_COMPONENT_STRING, "Player Invincibility: ~r~Off~r~");
  43.                     Function.Call(Hash._DRAW_NOTIFICATION, 0, 0);
  44.                     Wait(200);
  45.                 }
  46.             }
  47.  
  48.             if (invincible)
  49.             {
  50.                 //Game.Player.IsInvincible = true;
  51.                 player.Health = maxHealth;
  52.                 player.Armor = 100;
  53.                 player.AlwaysDiesOnLowHealth = false;
  54.                 if (Function.Call<bool>(Hash.IS_PED_IN_ANY_VEHICLE, player, false))
  55.                 {
  56.                     if (veh.IsOnFire || veh.IsInAir)
  57.                     {
  58.                         player.IsInvincible = true;
  59.                     }
  60.                     else
  61.                     {
  62.                         player.IsInvincible = false;
  63.                     }
  64.                 }
  65.             }
  66.         }
  67.        
  68.         void OnKeyDown(object sender, KeyEventArgs e)
  69.         {
  70.         }
  71.  
  72.         void OnKeyUp(object sender, KeyEventArgs e)
  73.         {
  74.         }
  75.     }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement