Advertisement
Guest User

LandOnFeet

a guest
Aug 19th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.79 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 LandOnFeet
  8. {
  9.     public class LandOnFeet : Script // declare Modname as a script
  10.     {
  11.         public LandOnFeet() // main function
  12.         {
  13.             Tick += OnTick;
  14.             KeyDown += OnKeyDown;
  15.             KeyUp += OnKeyUp;
  16.  
  17.         }
  18.  
  19.         enum RagdollType
  20.         {
  21.             Normal = 0,
  22.             StiffBody = 1,
  23.             NarrowLegStumble = 2,
  24.             WideLegStumble = 3
  25.         }
  26.  
  27.         void OnTick(object sender, EventArgs e) // This is where most of your script goes
  28.         {
  29.             if (Game.IsControlJustPressed(2, GTA.Control.Sprint) || Game.IsControlJustPressed(2, GTA.Control.Jump))
  30.             {
  31.                 if (Game.Player.Exists() && Game.Player.IsAlive)
  32.                 {
  33.                     Ped player = Game.Player.Character; // player variable
  34.  
  35.                     if (player.IsOnFoot && player.IsRagdoll && player.IsInAir && player.HeightAboveGround < 5f)
  36.                     {
  37.                         SetPedRagdoll(player, 10, RagdollType.StiffBody);
  38.                     }
  39.                 }
  40.             }
  41.         }
  42.  
  43.         void SetPedRagdoll(Ped p, int ms, RagdollType type)
  44.         {
  45.             Function.Call(Hash.SET_PED_CAN_RAGDOLL, p, true);
  46.             Function.Call(Hash.SET_PED_TO_RAGDOLL, p, ms, ms, (int)type, 1, 1, 0);
  47.         }
  48.  
  49.         void OnKeyDown(object sender, KeyEventArgs e)
  50.         {
  51.         }
  52.  
  53.         void OnKeyUp(object sender, KeyEventArgs e)
  54.         {
  55.         }
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement