@@ -210,7 +210,7 @@ local ping = 0
210
210
local swingrange = 48
211
211
local tickRate = 66
212
212
local tick_count = 0
213
- local time = 15
213
+ local time = 14
214
214
local Gcan_attack = false
215
215
local Safe_Strafe = false
216
216
local can_charge = false
@@ -221,7 +221,7 @@ local Backtrackpositions = {}
221
221
local pLocalPath = {}
222
222
local vPlayerPath = {}
223
223
local PredPath = {}
224
- local vHitbox = { Vector3 (- 24 , - 24 , 0 ), Vector3 (24 , 24 , 82 ) }
224
+ local vHitbox = { Vector3 (- 24 , - 24 , 0 ), Vector3 (24 , 24 , 80 ) }
225
225
local drawVhitbox = {}
226
226
local gravity = client .GetConVar (" sv_gravity" ) or 800 -- Get the current gravity
227
227
local stepSize = pLocal :GetPropFloat (" localdata" , " m_flStepSize" ) or 18
@@ -260,9 +260,16 @@ local lastDeltas = {} ---@type table<number, number>
260
260
local avgDeltas = {} --- @type table<number , number>
261
261
local strafeAngles = {} --- @type table<number , number>
262
262
local inaccuracy = {} --- @type table<number , number>
263
+ local pastPositions = {} -- Stores past positions of the local player
264
+ local maxPositions = 4 -- Number of past positions to consider
265
+
263
266
264
267
local function CalcStrafe ()
265
268
local players = entities .FindByClass (" CTFPlayer" )
269
+ local autostrafe = gui .GetValue (" Auto Strafe" )
270
+ local flags = pLocal :GetPropInt (" m_fFlags" )
271
+ local OnGround = flags & FL_ONGROUND == 1
272
+
266
273
for idx , entity in ipairs (players ) do
267
274
local entityIndex = entity :GetIndex ()
268
275
@@ -276,6 +283,24 @@ local function CalcStrafe()
276
283
end
277
284
278
285
local v = entity :EstimateAbsVelocity ()
286
+ if entity == pLocal then
287
+ table.insert (pastPositions , 1 , entity :GetAbsOrigin ())
288
+ if # pastPositions > maxPositions then
289
+ table.remove (pastPositions )
290
+ end
291
+
292
+
293
+ if not onGround and autostrafe == 2 and # pastPositions >= maxPositions then
294
+ v = Vector3 (0 , 0 , 0 )
295
+ for i = 1 , # pastPositions - 1 do
296
+ v = v + (pastPositions [i ] - pastPositions [i + 1 ])
297
+ end
298
+ v = v / (maxPositions - 1 )
299
+ else
300
+ v = entity :EstimateAbsVelocity ()
301
+ end
302
+ end
303
+
279
304
local angle = v :Angles ()
280
305
281
306
if lastAngles [entityIndex ] == nil then
@@ -683,7 +708,7 @@ local function checkInRangeWithLatency(playerIndex, swingRange)
683
708
return inRange , point
684
709
end
685
710
686
- inRange = checkInRange (vPlayerFuture , pLocalFuture , swingRange )
711
+ inRange , point = checkInRange (vPlayerFuture , pLocalFuture , swingRange )
687
712
if inRange then
688
713
return inRange , point , can_charge
689
714
end
@@ -762,7 +787,7 @@ local function checkInRangeWithLatency(playerIndex, swingRange)
762
787
return inRange , point
763
788
end
764
789
765
- inRange = checkInRange (vPlayerFuture , pLocalFuture , swingRange )
790
+ inRange , point = checkInRange (vPlayerFuture , pLocalFuture , swingRange )
766
791
if inRange then
767
792
return inRange , point
768
793
end
@@ -787,7 +812,6 @@ local function OnCreateMove(pCmd)
787
812
if not pLocal or not pLocal :IsAlive () then
788
813
goto continue -- Return if the local player entity doesn't exist or is dead
789
814
end
790
-
791
815
-- Check if the local player is a spy
792
816
pLocalClass = pLocal :GetPropInt (" m_iClass" )
793
817
if pLocalClass == nil or pLocalClass == 8 then
@@ -805,7 +829,7 @@ local function OnCreateMove(pCmd)
805
829
local latIn = clientstate .GetLatencyIn ()
806
830
lerp = client .GetConVar (" cl_interp" ) or 0
807
831
Latency = (latOut + lerp ) -- Calculate the reaction time in seconds
808
- Latency = math.floor (Latency * tickRate + 1 ) -- Convert the delay to ticks
832
+ Latency = math.floor (Latency * ( globals . TickInterval () * 66 ) + 1 ) -- Convert the delay to ticks
809
833
defFakeLatency = gui .GetValue (" Fake Latency Value (MS)" )
810
834
811
835
-- Get the local player's flags and charge meter
@@ -862,7 +886,7 @@ local function OnCreateMove(pCmd)
862
886
-- [-------- Get SwingRange --------]
863
887
swingrange = pWeapon :GetSwingRange ()
864
888
865
- local SwingHullSize = 36
889
+ local SwingHullSize = 35.6
866
890
867
891
if pWeaponDef :GetName () == " The Disciplinary Action" then
868
892
SwingHullSize = 55.8
@@ -935,11 +959,11 @@ end
935
959
gui .SetValue (" Melee Crit Hack" , Menu .Misc .CritMode )
936
960
end
937
961
938
- local ONGround
939
962
local Target_ONGround
940
963
local strafeAngle = 0
941
964
local can_attack = false
942
965
local stop = false
966
+ local OnGround = flags & FL_ONGROUND == 1
943
967
944
968
-- [--------------Prediction-------------------]
945
969
-- Predict both players' positions after swing
948
972
949
973
CalcStrafe ()
950
974
951
-
952
975
if inaccuracyValue then
953
- swingrange = swingrange - inaccuracyValue
976
+ swingrange = swingrange - math.abs ( inaccuracyValue )
954
977
end
955
978
956
979
-- Local player prediction
@@ -975,8 +998,8 @@ if CurrentTarget == nil then
975
998
end
976
999
vPlayerOrigin = CurrentTarget :GetAbsOrigin () -- Get closest player origin
977
1000
978
- local pFlags = CurrentTarget :GetPropInt (" m_fFlags" )
979
- local DUCKING = flags & FL_DUCKING == 2
1001
+ local VpFlags = CurrentTarget :GetPropInt (" m_fFlags" )
1002
+ local DUCKING = VpFlags & FL_DUCKING == 2
980
1003
if DUCKING then
981
1004
vHitbox [2 ].z = 62
982
1005
else
@@ -1058,16 +1081,6 @@ vdistance = (vPlayerOrigin - pLocalOrigin):Length()
1058
1081
-- Control charge if charge bot is enabled and the local player is in condition 17
1059
1082
ChargeControl (pCmd )
1060
1083
end
1061
-
1062
- -- Shield bashing strat
1063
- if pLocalClass == 4 and pLocal :InCond (17 ) then -- If we are charging (17 is TF_COND_SHIELD_CHARGE)
1064
- local Bashed = (pLocalOrigin - vPlayerOrigin ):Length () < swingrange - 18 -- If we bashed on enemy
1065
-
1066
- if not Bashed then -- If Demoknight bashed on enemy
1067
- can_attack = false
1068
- goto continue
1069
- end
1070
- end
1071
1084
1072
1085
-- Check if attack simulation was succesfull
1073
1086
if can_attack == true then
0 commit comments