Skip to content

Commit c0f344c

Browse files
Add files via upload
1 parent fd62b49 commit c0f344c

File tree

1 file changed

+126
-14
lines changed

1 file changed

+126
-14
lines changed

A_Swing_Prediction.lua

+126-14
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,15 @@ local Menu = {
5555

5656
Aimbot = {
5757
Aimbot = true,
58+
ChargeBot = true,
5859
AimbotFOV = 360,
5960
Silent = true,
6061
},
6162
Visuals = {
6263
EnableVisuals = false,
6364
RangeCircle = true,
6465
Visualization = true,
66+
Sphere = false,
6567
},
6668
Misc = {
6769
ChargeControl = true,
@@ -896,6 +898,76 @@ local toggleCooldown = 0.2 -- 200 milliseconds
896898
local bindTimer = 0
897899
local bindDelay = 0.15 -- Delay of 0.2 seconds
898900

901+
local sphere_cache = { vertices = {}, segments = 16, radius = 90, center = Vector3(0, 0, 0) } -- Cache for the sphere's vertices
902+
903+
-- Function to setup the sphere's vertices
904+
local function setup_sphere(center, radius, segments)
905+
sphere_cache.center = center
906+
sphere_cache.radius = radius
907+
sphere_cache.segments = segments
908+
sphere_cache.vertices = {} -- Clear the old vertices
909+
910+
for i = 0, segments - 1 do
911+
local theta1 = math.pi * (i / segments)
912+
local theta2 = math.pi * ((i + 1) / segments)
913+
914+
for j = 0, segments - 1 do
915+
local phi1 = 2 * math.pi * (j / segments)
916+
local phi2 = 2 * math.pi * ((j + 1) / segments)
917+
918+
-- Generate two triangles for each square segment
919+
table.insert(sphere_cache.vertices, {
920+
Vector3(math.sin(theta1) * math.cos(phi1), math.sin(theta1) * math.sin(phi1), math.cos(theta1)),
921+
Vector3(math.sin(theta1) * math.cos(phi2), math.sin(theta1) * math.sin(phi2), math.cos(theta1)),
922+
Vector3(math.sin(theta2) * math.cos(phi1), math.sin(theta2) * math.sin(phi1), math.cos(theta2)),
923+
})
924+
table.insert(sphere_cache.vertices, {
925+
Vector3(math.sin(theta2) * math.cos(phi1), math.sin(theta2) * math.sin(phi1), math.cos(theta2)),
926+
Vector3(math.sin(theta1) * math.cos(phi2), math.sin(theta1) * math.sin(phi2), math.cos(theta1)),
927+
Vector3(math.sin(theta2) * math.cos(phi2), math.sin(theta2) * math.sin(phi2), math.cos(theta2)),
928+
})
929+
end
930+
end
931+
end
932+
933+
-- Call setup_sphere once at the start of your program
934+
setup_sphere(Vector3(0, 0, 0), 90, 16)
935+
936+
local white_texture = draw.CreateTextureRGBA(string.char(
937+
0xff, 0xff, 0xff, 25,
938+
0xff, 0xff, 0xff, 25,
939+
0xff, 0xff, 0xff, 25,
940+
0xff, 0xff, 0xff, 25
941+
), 2, 2);
942+
943+
local drawPolygon = (function()
944+
local v1x, v1y = 0, 0;
945+
local function cross(a, b)
946+
return (b[1] - a[1]) * (v1y - a[2]) - (b[2] - a[2]) * (v1x - a[1])
947+
end
948+
949+
local TexturedPolygon = draw.TexturedPolygon;
950+
951+
return function(vertices)
952+
local cords, reverse_cords = {}, {};
953+
local sizeof = #vertices;
954+
local sum = 0;
955+
956+
v1x, v1y = vertices[1][1], vertices[1][2];
957+
for i, pos in pairs(vertices) do
958+
local convertedTbl = {pos[1], pos[2], 0, 0};
959+
960+
cords[i], reverse_cords[sizeof - i + 1] = convertedTbl, convertedTbl;
961+
962+
sum = sum + cross(pos, vertices[(i % sizeof) + 1]);
963+
end
964+
965+
966+
TexturedPolygon(white_texture, (sum < 0) and reverse_cords or cords, true)
967+
end
968+
end)();
969+
970+
899971
local function toggleMenu()
900972
local currentTime = globals.RealTime()
901973
if currentTime - lastToggleTime >= toggleCooldown then
@@ -965,23 +1037,57 @@ if not (engine.Con_IsVisible() or engine.IsGameUIVisible()) then
9651037
draw.Line(vertices[i][1], vertices[i][2], vertices[j][1], vertices[j][2])
9661038
end
9671039
end
968-
end
969-
970-
--[[Draw crosses at the positions stored in playerTicks for all players
971-
if playerTicks then
972-
for playerIndex, positions in pairs(playerTicks) do
973-
for i = 1, #positions do
974-
local pos = positions[i]
975-
976-
local screenPos = client.WorldToScreen(pos)
977-
978-
if screenPos ~= nil then
979-
draw.Line(screenPos[1] + 10, screenPos[2], screenPos[1] - 10, screenPos[2])
980-
draw.Line(screenPos[1], screenPos[2] - 10, screenPos[1], screenPos[2] + 10)
1040+
---------------------------------------------------------sphere
1041+
if Menu.Visuals.Sphere then
1042+
-- Function to draw the sphere
1043+
local function draw_sphere()
1044+
for _, vertex in ipairs(sphere_cache.vertices) do
1045+
local worldPos1 = sphere_cache.center + vertex[1] * sphere_cache.radius
1046+
local worldPos2 = sphere_cache.center + vertex[2] * sphere_cache.radius
1047+
local worldPos3 = sphere_cache.center + vertex[3] * sphere_cache.radius
1048+
1049+
-- Trace from the center to the vertices
1050+
local trace1 = engine.TraceHull(sphere_cache.center, worldPos1, Vector3(-18, -18, -18), Vector3(18, 18, 18), MASK_SHOT_HULL)
1051+
local trace2 = engine.TraceHull(sphere_cache.center, worldPos2, Vector3(-18, -18, -18), Vector3(18, 18, 18), MASK_SHOT_HULL)
1052+
local trace3 = engine.TraceHull(sphere_cache.center, worldPos3, Vector3(-18, -18, -18), Vector3(18, 18, 18), MASK_SHOT_HULL)
1053+
1054+
-- Adjust the end position of the vertices based on the trace results
1055+
local endPos1 = trace1.fraction < 1.0 and trace1.endpos or worldPos1
1056+
local endPos2 = trace2.fraction < 1.0 and trace2.endpos or worldPos2
1057+
local endPos3 = trace3.fraction < 1.0 and trace3.endpos or worldPos3
1058+
1059+
local screenPos1 = client.WorldToScreen(endPos1)
1060+
local screenPos2 = client.WorldToScreen(endPos2)
1061+
local screenPos3 = client.WorldToScreen(endPos3)
1062+
1063+
if screenPos1 and screenPos2 and screenPos3 then
1064+
-- Convert the screen positions to the format expected by drawPolygon
1065+
local polygonVertices = {
1066+
{screenPos1[1], screenPos1[2]},
1067+
{screenPos2[1], screenPos2[2]},
1068+
{screenPos3[1], screenPos3[2]}
1069+
}
1070+
1071+
-- Call drawPolygon to draw the triangle
1072+
drawPolygon(polygonVertices)
1073+
1074+
-- Set the color and alpha for the lines
1075+
draw.Color(255, 255, 255, 25)
1076+
1077+
-- Draw the lines
1078+
draw.Line(screenPos1[1], screenPos1[2], screenPos2[1], screenPos2[2])
1079+
draw.Line(screenPos2[1], screenPos2[2], screenPos3[1], screenPos3[2])
1080+
draw.Line(screenPos3[1], screenPos3[2], screenPos1[1], screenPos1[2])
1081+
end
1082+
end
9811083
end
1084+
-- Example draw call, to be done every tick to draw the sphere at the current position and radius
1085+
---setup_sphere(Vector3(0, 0, 0), 90, 16)
1086+
sphere_cache.center = pLocalOrigin
1087+
sphere_cache.radius = swingrange
1088+
draw_sphere()
9821089
end
9831090
end
984-
end]]
9851091

9861092
-- enemy
9871093
if vPlayerFuture then
@@ -1076,6 +1182,7 @@ if not (engine.Con_IsVisible() or engine.IsGameUIVisible()) then
10761182

10771183
ImMenu.BeginFrame(1)
10781184
Menu.Aimbot.Silent = ImMenu.Checkbox("Silent Aim", Menu.Aimbot.Silent)
1185+
Menu.Aimbot.ChargeBot = ImMenu.Checkbox("Charge Bot", Menu.Aimbot.ChargeBot)
10791186
ImMenu.EndFrame()
10801187

10811188
ImMenu.BeginFrame(1)
@@ -1146,6 +1253,11 @@ if not (engine.Con_IsVisible() or engine.IsGameUIVisible()) then
11461253
Menu.Visuals.Visualization = ImMenu.Checkbox("Visualization", Menu.Visuals.Visualization)
11471254
Menu.Visuals.RangeCircle = ImMenu.Checkbox("Range Circle", Menu.Visuals.RangeCircle)
11481255
ImMenu.EndFrame()
1256+
1257+
ImMenu.BeginFrame(1)
1258+
ImMenu.Text("Experimental")
1259+
Menu.Visuals.Sphere = ImMenu.Checkbox("Range Sphere", Menu.Visuals.Sphere)
1260+
ImMenu.EndFrame()
11491261
end
11501262
ImMenu.End()
11511263
end

0 commit comments

Comments
 (0)