Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using GTA;
- using GTA.Native;
- using System.Windows.Forms;
- namespace Stance
- {
- public class Main : Script
- {
- private Main.Stance currentStance;
- public Main()
- {
- this.KeyUp += new KeyEventHandler(this.OnKeyUp);
- }
- private void OnKeyUp(object sender, KeyEventArgs e)
- {
- if (this.currentStance == Main.Stance.Standing)
- {
- if (e.KeyCode != StanceSettings.stanceKey)
- return;
- this.SetStance(Main.Stance.Crouching);
- }
- else if (this.currentStance == Main.Stance.Crouching)
- {
- if (e.KeyCode != StanceSettings.stanceKey)
- return;
- this.SetStance(Main.Stance.Standing);
- }
- }
- private void Requests()
- {
- Function.Call(Hash._0x6EA47DAE7FAD0EED, (InputArgument)"move_ped_crouched");
- Function.Call(Hash._0x6EA47DAE7FAD0EED, (InputArgument)"move_ped_crouched_strafing");
- }
- private void StanceChanger()
- {
- if (this.currentStance == Main.Stance.Standing)
- {
- if (Game.IsControlPressed(0, GTA.Control.Duck))
- {
- this.SetStance(Main.Stance.Crouching);
- }
- }
- else if (this.currentStance == Main.Stance.Crouching)
- {
- if (Game.IsControlPressed(0, GTA.Control.Duck))
- {
- this.SetStance(Main.Stance.Standing);
- }
- }
- }
- private void SetStance(Main.Stance stance)
- {
- switch (stance)
- {
- case Main.Stance.Standing:
- Function.Call(Hash._0xAA74EC0CB0AAEA2C, (InputArgument)Game.Player.Character, (InputArgument)1048576000);
- Function.Call(Hash._0x20510814175EA477, (InputArgument)Game.Player.Character);
- Game.Player.Character.Task.ClearAll();
- this.currentStance = Main.Stance.Standing;
- break;
- case Main.Stance.Crouching:
- Function.Call(Hash._0xAF8A94EDE7712BEF, (InputArgument)Game.Player.Character, (InputArgument)"move_ped_crouched", (InputArgument)1048576000);
- Function.Call(Hash._0x29A28F3F8CF6D854, (InputArgument)Game.Player.Character, (InputArgument)"move_ped_crouched_strafing");
- Game.Player.Character.Task.ClearAll();
- this.currentStance = Main.Stance.Crouching;
- break;
- }
- }
- private enum Stance
- {
- Standing,
- Crouching,
- }
- }
- }
- namespace Stance
- {
- public class StanceSettings : Script
- {
- private ScriptSettings iniFile;
- public static Keys stanceKey;
- public StanceSettings()
- {
- this.iniFile = ScriptSettings.Load("scripts//Stance.ini");
- StanceSettings.stanceKey = this.iniFile.GetValue<Keys>("Keys", nameof(stanceKey), Keys.J);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement