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 LandOnFeet
- {
- public class LandOnFeet : Script // declare Modname as a script
- {
- public LandOnFeet() // main function
- {
- Tick += OnTick;
- KeyDown += OnKeyDown;
- KeyUp += OnKeyUp;
- }
- enum RagdollType
- {
- Normal = 0,
- StiffBody = 1,
- NarrowLegStumble = 2,
- WideLegStumble = 3
- }
- void OnTick(object sender, EventArgs e) // This is where most of your script goes
- {
- if (Game.IsControlJustPressed(2, GTA.Control.Sprint) || Game.IsControlJustPressed(2, GTA.Control.Jump))
- {
- if (Game.Player.Exists() && Game.Player.IsAlive)
- {
- Ped player = Game.Player.Character; // player variable
- if (player.IsOnFoot && player.IsRagdoll && player.IsInAir && player.HeightAboveGround < 5f)
- {
- SetPedRagdoll(player, 10, RagdollType.StiffBody);
- }
- }
- }
- }
- void SetPedRagdoll(Ped p, int ms, RagdollType type)
- {
- Function.Call(Hash.SET_PED_CAN_RAGDOLL, p, true);
- Function.Call(Hash.SET_PED_TO_RAGDOLL, p, ms, ms, (int)type, 1, 1, 0);
- }
- void OnKeyDown(object sender, KeyEventArgs e)
- {
- }
- void OnKeyUp(object sender, KeyEventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement