-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.lua
107 lines (88 loc) · 2.76 KB
/
script.lua
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
local weapon_table = {Horizontal = 0, Vertical = 10, FireDelay = 10}
local toggle_key = "numlock"
local fire_key = 1
local is_active = true
function Volatility(_range, _impact)
local volatility = _range * (1 + _impact * math.random())
return volatility
end
function Move_x(_horizontal_recoil)
MoveMouseRelative(math.floor(Volatility(0.8, 1) * _horizontal_recoil), 0)
end
function Move_y(_vertical_recoil)
MoveMouseRelative(0, math.floor(Volatility(0.8, 1) * _vertical_recoil))
end
function Fire()
local horizontal_recoil = weapon_table["Horizontal"]
local vertical_recoil = weapon_table["Vertical"]
local float_x = math.abs(horizontal_recoil) - math.floor(math.abs(horizontal_recoil))
local float_y = math.abs(vertical_recoil) - math.floor(math.abs(vertical_recoil))
local i = 0
local j = 0
repeat
if horizontal_recoil ~= 0 then
if horizontal_recoil < 0 then
Move_x(horizontal_recoil + float_x)
else
Move_x(vertical_recoil - float_x)
end
end
if vertical_recoil ~= 0 then
if vertical_recoil < 0 then
Move_y(vertical_recoil + float_y)
else
Move_y(vertical_recoil - float_y)
end
end
if float_x ~= 0 then
i = i + float_x
if i >= 1 * Volatility(0.7, 1) then
if horizontal_recoil > 0 then
Move_x(1)
else
Move_x(-1)
end
i = 0
end
end
if float_y ~= 0 then
j = j + float_y
if j >= 1 * Volatility(0.7, 1) then
if vertical_recoil > 0 then
Move_y(1)
else
Move_y(-1)
end
j = 0
end
end
Sleep(math.floor(Volatility(0.8, 0.5) * weapon_table["FireDelay"]))
until not IsMouseButtonPressed(fire_key)
end
function OnEvent(event, arg)
if event == "PROFILE_ACTIVATED" then
EnablePrimaryMouseButtonEvents(true)
elseif event == "PROFILE_DEACTIVATED" then
ReleaseMouseButton(fire_key)
end
if IsKeyLockOn(toggle_key) then
if is_active == false then
is_active = true
end
if event == "MOUSE_BUTTON_PRESSED" and arg == fire_key then
Fire()
end
else
if is_active == true then
is_active = false
end
end
end
function Initialize()
if IsKeyLockOn(toggle_key) then
is_active = true
else
is_active = false
end
end
Initialize()