@@ -37,7 +37,8 @@ menu.Style.Outline = true -- Outline around the menu
37
37
end, ItemFlags.FullWidth))]]
38
38
local Swingpred = menu :AddComponent (MenuLib .Checkbox (" Enable" , true , ItemFlags .FullWidth ))
39
39
local Maimbot = menu :AddComponent (MenuLib .Checkbox (" Aimbot(Rage)" , true , ItemFlags .FullWidth ))
40
- local mtime = menu :AddComponent (MenuLib .Slider (" attack delay(ticks)" ,3 ,20 ,14 ))
40
+ local mFov = menu :AddComponent (MenuLib .Slider (" Aimbot FOV" ,10 ,360 ,180 ))
41
+ local mtime = menu :AddComponent (MenuLib .Slider (" prediction(ticks)" ,3 ,20 ,14 ))
41
42
local mAutoRefill = menu :AddComponent (MenuLib .Checkbox (" Crit Refill" , true ))
42
43
local mAutoGarden = menu :AddComponent (MenuLib .Checkbox (" Troldier assist" , false ))
43
44
local mmVisuals = menu :AddComponent (MenuLib .Checkbox (" Enable Visuals" , false ))
@@ -61,7 +62,6 @@ local vPlayerOrigin = nil
61
62
local pLocal = entities .GetLocalPlayer () -- Immediately set "pLocal" to the local player (entities.GetLocalPlayer)
62
63
local tickRate = 66 -- game tick rate
63
64
local pLocalOrigin
64
- local closestPlayer
65
65
local closestDistance = 2000
66
66
local tick
67
67
local pLocalClass
@@ -76,72 +76,82 @@ local vPlayerFuture
76
76
local pLocalFuture
77
77
local ping = 0
78
78
79
+ local settings = {
80
+ MinDistance = 200 ,
81
+ MaxDistance = 1000 ,
82
+ MinHealth = 10 ,
83
+ MaxHealth = 100 ,
84
+ MinFOV = 0 ,
85
+ MaxFOV = mFov :GetValue (),
86
+ }
87
+
79
88
--- @param me WPlayer
80
89
--- @return AimTarget ? target
81
90
local function GetBestTarget (me )
82
- local settings = {
91
+ settings = {
83
92
MinDistance = 200 ,
84
93
MaxDistance = 1000 ,
85
94
MinHealth = 10 ,
86
95
MaxHealth = 100 ,
87
96
MinFOV = 0 ,
88
- MaxFOV = 360 ,
97
+ MaxFOV = mFov : GetValue () ,
89
98
}
90
99
91
- local players = entities .FindByClass (" CTFPlayer" )
92
- local localPlayer = entities .GetLocalPlayer ()
93
- if not localPlayer then return end
94
-
95
- --- @type Target[]
96
- local targetList = {}
97
-
98
- -- Calculate target factors
99
- for entIdx , player in pairs (players ) do
100
- if entIdx == localPlayer :GetIndex () then goto continue end
101
-
102
- local distance = (player :GetAbsOrigin () - localPlayer :GetAbsOrigin ()):Length ()
103
- local health = player :GetHealth ()
104
-
105
- local angles = Math .PositionAngles (localPlayer :GetAbsOrigin (), player :GetAbsOrigin ())
106
- local fov = Math .AngleFov (engine .GetViewAngles (), angles )
107
-
108
- local distanceFactor = Math .RemapValClamped (distance , settings .MinDistance , settings .MaxDistance , 1 , 0.1 )
109
- local healthFactor = Math .RemapValClamped (health , settings .MinHealth , settings .MaxHealth , 1 , 0.5 )
110
- local fovFactor = Math .RemapValClamped (fov , settings .MinFOV , settings .MaxFOV , 1 , 0.5 )
111
-
112
- local factor = distanceFactor * healthFactor * fovFactor
113
- table.insert (targetList , { player = player , factor = factor })
114
-
115
- :: continue::
116
- end
117
-
118
- -- Sort target list by factor
119
- table.sort (targetList , function (a , b )
120
- return a .factor > b .factor
121
- end )
122
-
123
- local bestTarget = nil
124
-
125
- for _ , target in ipairs (targetList ) do
126
- local player = target .player
127
- local aimPos = player :GetAbsOrigin ()
128
- local angles = Math .PositionAngles (localPlayer :GetAbsOrigin (), aimPos )
129
- local fov = Math .AngleFov (angles , engine .GetViewAngles ())
130
- if fov > 360 then goto continue end
131
-
132
- -- Visibility Check
133
- if not Helpers .VisPos (player , pLocalOrigin , aimPos ) then goto continue end
134
- if target .player == nil or not target .player :IsAlive () or target .player :GetTeamNumber () == pLocal :GetTeamNumber () then goto continue end
135
-
136
- -- Set as best target
137
- bestTarget = { entity = player , pos = aimPos , angles = angles , factor = target .factor }
138
- break
139
-
140
- :: continue::
141
- end
142
-
143
- return bestTarget
100
+ local players = entities .FindByClass (" CTFPlayer" )
101
+ local localPlayer = entities .GetLocalPlayer ()
102
+ if not localPlayer then return end
103
+
104
+ --- @type Target[]
105
+ local targetList = {}
106
+
107
+ -- Calculate target factors
108
+ for entIdx , player in pairs (players ) do
109
+ if entIdx == localPlayer :GetIndex () then goto continue end
110
+
111
+ local distance = (player :GetAbsOrigin () - localPlayer :GetAbsOrigin ()):Length ()
112
+ local health = player :GetHealth ()
113
+
114
+ local angles = Math .PositionAngles (localPlayer :GetAbsOrigin (), player :GetAbsOrigin ())
115
+ local fov = Math .AngleFov (engine .GetViewAngles (), angles )
116
+
117
+ local distanceFactor = Math .RemapValClamped (distance , settings .MinDistance , settings .MaxDistance , 1 , 0.1 )
118
+ local healthFactor = Math .RemapValClamped (health , settings .MinHealth , settings .MaxHealth , 1 , 0.5 )
119
+ local fovFactor = Math .RemapValClamped (fov , settings .MinFOV , settings .MaxFOV , 1 , 0.5 )
120
+
121
+ local factor = distanceFactor * healthFactor * fovFactor
122
+ table.insert (targetList , { player = player , factor = factor })
123
+
124
+ :: continue::
144
125
end
126
+
127
+ -- Sort target list by factor
128
+ table.sort (targetList , function (a , b )
129
+ return a .factor > b .factor
130
+ end )
131
+
132
+ local bestTarget = nil
133
+
134
+ for _ , target in ipairs (targetList ) do
135
+ local player = target .player
136
+ local aimPos = player :GetAbsOrigin ()
137
+ local angles = Math .PositionAngles (localPlayer :GetAbsOrigin (), aimPos )
138
+ local fov = Math .AngleFov (angles , engine .GetViewAngles ())
139
+ if fov > settings .MaxFOV then goto continue end
140
+
141
+ -- Visibility Check
142
+ if not Helpers .VisPos (player , pLocalOrigin , aimPos ) then goto continue end
143
+ if target .player == nil or not target .player :IsAlive () or target .player :GetTeamNumber () == pLocal :GetTeamNumber () then goto continue end
144
+
145
+ -- Set as best target
146
+ bestTarget = { entity = player , pos = aimPos , angles = angles , factor = target .factor }
147
+ break
148
+
149
+ :: continue::
150
+ end
151
+
152
+ return bestTarget
153
+ end
154
+
145
155
146
156
147
157
function TargetPositionPrediction (targetLastPos , time , targetEntity )
@@ -275,6 +285,8 @@ local function OnCreateMove(pCmd)
275
285
local pWeapon = pLocal :GetPropEntity (" m_hActiveWeapon" )
276
286
local players = entities .FindByClass (" CTFPlayer" ) -- Create a table of all players in the game
277
287
local time = mtime :GetValue ()
288
+ local closestPlayer
289
+ if # players == 0 then return end -- Immediately check if there are any players in the game. If there aren't, return.
278
290
-- [--if we enabled trodlier assist run auto weapon script]
279
291
if mAutoGarden :GetValue () == true then
280
292
local flags = pLocal :GetPropInt ( " m_fFlags" )
346
358
fDistance = (vPlayerFuture - pLocalFuture ):Length ()
347
359
348
360
--[[ -----------------------------Swing Prediction------------------------------------------------------------------------]]
361
+
349
362
local can_attack = false
350
363
local stop = false
351
364
swingrange = pWeapon :GetSwingRange ()
@@ -362,23 +375,21 @@ end
362
375
end
363
376
end
364
377
365
- -- [--------------AimBot-------------------]
366
- if Maimbot :GetValue () and Helpers .VisPos (closestPlayer ,vPlayerFuture + Vector3 (0 , 0 , 150 ), pLocalFuture ) then
367
- -- get hitbox of ennmy pelwis(jittery but works)
378
+ -- [--------------AimBot-------------------] --get hitbox of ennmy pelwis(jittery but works)
368
379
local hitboxes = closestPlayer :GetHitboxes ()
369
380
local hitbox = hitboxes [4 ]
370
381
local aimpos = (hitbox [1 ] + hitbox [2 ]) * 0.5
382
+ if Maimbot :GetValue () and Helpers .VisPos (closestPlayer ,vPlayerFuture + Vector3 (0 , 0 , 150 ), pLocalFuture ) and pLocal :InCond (17 ) then
371
383
372
- if pLocal :InCond (17 ) then -- if can hit then aimbot
373
384
-- change angles at target
374
385
aimpos = Math .PositionAngles (pLocalOrigin , vPlayerFuture + Vector3 (0 , 0 , 60 ))
375
386
pCmd :SetViewAngles (aimpos :Unpack ()) -- engine.SetViewAngles(aimpos)
376
387
377
- else -- if predicted position is visible then aim at it
388
+ else -- if predicted position is visible then aim at it
378
389
-- change angles at target
379
390
aimpos = Math .PositionAngles (pLocalOrigin , aimpos )
380
- pCmd :SetViewAngles (aimpos :Unpack ())
381
- end
391
+ pCmd :SetViewAngles (aimpos :Unpack ()) -- engine.SetViewAngles(aimpos)
392
+
382
393
end
383
394
384
395
-- [----------------wall check Future-------------]
0 commit comments