@@ -567,22 +567,24 @@ local function PropUpdate()
567
567
local pWeapon = lastswingtracedata [1 ]
568
568
local spherePos = lastswingtracedata [2 ]
569
569
local closestPoint = lastswingtracedata [3 ]
570
- local Angle = Math .PositionAngles (spherePos , closestPoint )
570
+ if spherePos and closestPoint then
571
+ local Angle = Math .PositionAngles (spherePos , closestPoint )
571
572
572
- -- Adjust player position and view angles for swing trace
573
- pLocal :SetPropVector (spherePos , " tfnonlocaldata" , " m_vecOrigin" )
574
- pLocal :SetPropVector (Vector3 (Angle .x , Angle .y , Angle .z ), " tfnonlocaldata" , " m_angEyeAngles[0]" )
573
+ -- Adjust player position and view angles for swing trace
574
+ pLocal :SetPropVector (spherePos , " tfnonlocaldata" , " m_vecOrigin" )
575
+ pLocal :SetPropVector (Vector3 (Angle .x , Angle .y , Angle .z ), " tfnonlocaldata" , " m_angEyeAngles[0]" )
575
576
576
- -- Perform the swing trace
577
- local SwingTrace = pLocal .DoSwingTrace (pWeapon )
578
- swingresult = SwingTrace
577
+ -- Perform the swing trace
578
+ local SwingTrace = pLocal .DoSwingTrace (pWeapon )
579
+ swingresult = SwingTrace
579
580
580
- -- Reset the player's original position and view angles
581
- pLocal :SetPropVector (OriginalPosition , " tfnonlocaldata" , " m_vecOrigin" )
582
- pLocal :SetPropVector (OriginalAngles , " tfnonlocaldata" , " m_angEyeAngles[0]" )
581
+ -- Reset the player's original position and view angles
582
+ pLocal :SetPropVector (OriginalPosition , " tfnonlocaldata" , " m_vecOrigin" )
583
+ pLocal :SetPropVector (OriginalAngles , " tfnonlocaldata" , " m_angEyeAngles[0]" )
583
584
584
- -- Clear last swing trace data
585
- lastswingtracedata = nil
585
+ -- Clear last swing trace data
586
+ lastswingtracedata = nil
587
+ end
586
588
end
587
589
end
588
590
@@ -726,7 +728,7 @@ local function checkInRangeWithLatency(playerIndex, swingRange, pWeapon, cmd)
726
728
if inRange then
727
729
return inRange , point , can_charge
728
730
end
729
- elseif fakelatencyON == 1 then
731
+ elseif fakelatencyON == 1 and playerTicks and playerTicks [ playerIndex ] then
730
732
if not hasNotified then
731
733
Notify .Simple (" Fake Latency is enabled" , " this may cause issues with the script" , 7 )
732
734
hasNotified = true
@@ -1123,10 +1125,6 @@ vdistance = (vPlayerOrigin - pLocalOrigin):Length()
1123
1125
:: continue::
1124
1126
end
1125
1127
1126
- local lastToggleTime = 0
1127
- local Lbox_Menu_Open = true
1128
- local toggleCooldown = 0.2 -- 200 milliseconds
1129
-
1130
1128
-- Sphere cache and drawn edges cache
1131
1129
local sphere_cache = { vertices = {}, radius = 90 , center = Vector3 (0 , 0 , 0 ) }
1132
1130
local drawnEdges = {}
@@ -1291,6 +1289,9 @@ local drawPolygon = (function()
1291
1289
end
1292
1290
end )();
1293
1291
1292
+ local lastToggleTime = 0
1293
+ local Lbox_Menu_Open = true
1294
+ local toggleCooldown = 0.2 -- 200 milliseconds
1294
1295
1295
1296
local function toggleMenu ()
1296
1297
local currentTime = globals .RealTime ()
0 commit comments