Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using GTA; // This is a reference that is needed! do not edit this
- using GTA.Math;
- using GTA.Native; // This is a reference that is needed! do not edit this
- using System; // This is a reference that is needed! do not edit this
- using System.Windows.Forms; // This is a reference that is needed! do not edit this
- namespace PersonalToggles
- {
- public class PersonalToggles : Script // declare Modname as a script
- {
- bool invincible = false;
- int maxHealth = 500;
- public PersonalToggles() // main function
- {
- Tick += this.OnTick;
- KeyDown += this.OnKeyDown;
- KeyUp += this.OnKeyUp;
- }
- void OnTick(object sender, EventArgs e) // This is where most of your script goes
- {
- Ped player = Game.Player.Character; // player variable
- //Turn on Special Godmode with X + Dpad Down
- if (Game.IsControlPressed(2, GTA.Control.Sprint) && Game.IsControlPressed(2, GTA.Control.PhoneDown))
- {
- if (!invincible)
- {
- invincible = true;
- player.MaxHealth = maxHealth;
- Function.Call(Hash._SET_NOTIFICATION_TEXT_ENTRY, "STRING");
- Function.Call(Hash._ADD_TEXT_COMPONENT_STRING, "Player Invincibility: ~g~On~g~");
- Function.Call(Hash._DRAW_NOTIFICATION, 0, 0);
- Wait(200);
- }
- else if (invincible)
- {
- invincible = false;
- player.IsInvincible = false;
- Function.Call(Hash._SET_NOTIFICATION_TEXT_ENTRY, "STRING");
- Function.Call(Hash._ADD_TEXT_COMPONENT_STRING, "Player Invincibility: ~r~Off~r~");
- Function.Call(Hash._DRAW_NOTIFICATION, 0, 0);
- Wait(200);
- }
- }
- if (invincible)
- {
- //Game.Player.IsInvincible = true;
- player.Health = maxHealth;
- player.Armor = 100;
- player.AlwaysDiesOnLowHealth = false;
- if (Function.Call<bool>(Hash.IS_PED_IN_ANY_VEHICLE, player, false))
- {
- if (veh.IsOnFire || veh.IsInAir)
- {
- player.IsInvincible = true;
- }
- else
- {
- player.IsInvincible = false;
- }
- }
- }
- }
- void OnKeyDown(object sender, KeyEventArgs e)
- {
- }
- void OnKeyUp(object sender, KeyEventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement