-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.cs
84 lines (80 loc) · 3.01 KB
/
Main.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System;
using System.Drawing;
using CitizenFX;
using CitizenFX.Core;
using CitizenFX.Core.Native;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Threading.Tasks;
namespace NoBunnyHop
{
public class NoBunnyHop : BaseScript
{
Cooldown coolDown = new Cooldown(0);
Cooldown cleaner = new Cooldown(1);
bool canRestore = false;
public NoBunnyHop()
{
coolDown.MaximumFrame = 2;
base.Tick += OnTick;
}
private async Task OnTick()
{
/// <summary>
/// Function below will try to restore the number of jumps to 0 when it's possible
/// </summary>
if (cleaner.HasExpired)
{
if (canRestore)
{
coolDown.ResetFrameCounter();
}
cleaner.Time = 12000;
}
/// <summary>
/// Wait for player to be spawned and only with OnFoot status
/// </summary>
if (Game.PlayerPed.IsOnScreen && Game.PlayerPed.IsOnFoot)
{
if (coolDown.HasExpired)
{
canRestore = true;
if (OnKeyDown.Sprint && OnKeyDown.Jump) //classic bunnyhop (sprint+jump)
{
canRestore = false;
if (Game.PlayerPed.IsSprinting || Game.PlayerPed.IsWalking || Game.PlayerPed.IsJumping)
{
//Make him ragdoll or any thing that reminds him it's boring to bunnyhop
Game.PlayerPed.Task.ClearAll();
}
}
else if(OnKeyDown.Jump) // clever bunnyhop (run/walk + jump)
{
canRestore = false;
if(Game.PlayerPed.IsRunning || Game.PlayerPed.IsWalking)
{
if(!Game.PlayerPed.IsClimbing || !Game.PlayerPed.IsVaulting) //prevent parkours boys from being flagged
{
if(coolDown.FrameCount < coolDown.MaximumFrame)
{
cleaner.Time = 12000;
coolDown.CountThisFrame();
}
else if(coolDown.FrameCount >= coolDown.MaximumFrame)
{
coolDown.Time = 8000;
coolDown.ResetFrameCounter();
}
}
}
}
}
else if(!coolDown.HasExpired)
{
Game.DisableControlThisFrame(2, CitizenFX.Core.Control.Jump); //rip jumping
}
}
await Task.FromResult(0);
}
}
}