-
Notifications
You must be signed in to change notification settings - Fork 13
/
Auto_E_Peek.lua
90 lines (60 loc) · 2.68 KB
/
Auto_E_Peek.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
local e_thing_tab = gui.Tab(gui.Reference("Ragebot"), "e.thing", "E Thing")
local e_thing_gb = gui.Groupbox(e_thing_tab, "E Thing", 10, 15, 600, 0 )
local e_thing_enabled = gui.Checkbox(e_thing_gb, "e.thing.enabled", "Enable", true)
local e_thing_prediction_amount = gui.Slider(e_thing_gb, "e.thing.prediction.amount", "Prediction amount", 0.30, 0.01, 1, 0.01)
local e_thing_draw_prediction = gui.Checkbox(e_thing_gb, "e.thing.draw.enabled", "Draw enable", true)
function predict_velocity(entity, prediction_amount)
local VelocityX = entity:GetPropFloat( "localdata", "m_vecVelocity[0]" );
local VelocityY = entity:GetPropFloat( "localdata", "m_vecVelocity[1]" );
local VelocityZ = entity:GetPropFloat( "localdata", "m_vecVelocity[2]" );
absVelocity = {VelocityX, VelocityY, VelocityZ}
pos_ = {entity:GetAbsOrigin()}
modifed_velocity = {vector.Multiply(absVelocity, prediction_amount)}
return {vector.Subtract({vector.Add(pos_, modifed_velocity)}, {0,0,0})}
end
function PlayersFilter(fn) -- not optimal for situation, should return stop loop after first time condition is met
local valid = {}
for k, player in pairs(entities.FindByClass("CCSPlayer")) do
if fn and fn(player) then
table.insert(valid, player)
end
end
return valid
end
local IN_USE = false
callbacks.Register("Draw", function()
if not e_thing_enabled:GetValue() then return end
local LocalPlayer = entities.GetLocalPlayer()
if not LocalPlayer then return end
local my_pos = LocalPlayer:GetAbsOrigin()
local prediction = predict_velocity(LocalPlayer, e_thing_prediction_amount:GetValue())
local x,y,z = vector.Add(
{my_pos.x, my_pos.y, my_pos.z},
{prediction[1], prediction[2], prediction[3]}
)
prediction = Vector3(x,y,z + 32)
local players = PlayersFilter(function(player)
local tr = engine.TraceLine(prediction,
player:GetAbsOrigin() + Vector3(0,0,32), 4294967295)
return tr and tr.entity and tr.entity:IsPlayer() and
tr.entity:GetTeamNumber() ~= LocalPlayer:GetTeamNumber()
end)
if #players ~= 0 and not IN_USE then
IN_USE = true
client.Command("+use", true)
elseif #players == 0 and IN_USE then
client.Command("-use", true)
IN_USE = false
end
if e_thing_draw_prediction:GetValue() and LocalPlayer:IsAlive() then
local x2,y2 = client.WorldToScreen(prediction)
draw.Color(255,0,0)
draw.Text(x2, y2, "PREDICTION")
end
end)
local has_target = false
callbacks.Register("AimbotTarget", function(t)
has_target = t:GetIndex()
end)
--***********************************************--
print("♥♥♥ " .. GetScriptName() .. " loaded without Errors ♥♥♥")