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 InvincibleRagdoll
- {
- public class InvincibleRagdoll : Script // declare Modname as a script
- {
- bool invincible = false;
- public InvincibleRagdoll() // 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
- if (player.IsRagdoll)
- {
- player.Health = player.MaxHealth;
- player.Armor = 100;
- Function.Call(Hash.SET_PED_SUFFERS_CRITICAL_HITS, player, false);
- player.AlwaysDiesOnLowHealth = false;
- invincible = true;
- }
- else
- {
- if (invincible) //to make the following code only run once, we check the "invincible" boolean
- {
- Function.Call(Hash.SET_PED_SUFFERS_CRITICAL_HITS, player, true);
- //player.AlwaysDiesOnLowHealth = true; //not sure if needed, so leaving it out.
- invincible = false;
- }
- }
- }
- void OnKeyDown(object sender, KeyEventArgs e)
- {
- }
- void OnKeyUp(object sender, KeyEventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement