Skip to content

Commit 60358fc

Browse files
v4.0
1 parent 3710e85 commit 60358fc

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

Hvh_Tools.lua

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ menu:AddComponent(MenuLib.Label(" [ Anty Aim ]", ItemFlags.FullWi
4949

5050
local RandomPitchtype = menu:AddComponent(MenuLib.Checkbox("Jitter Pitch type", true))
5151
local RandomToggle = menu:AddComponent(MenuLib.Checkbox("Jitter Yaw", true))
52-
52+
local mRoll = menu:AddComponent(MenuLib.Checkbox("Roll", true))
5353
local mDelay = menu:AddComponent(MenuLib.Slider("jitter Speed", 1, 66, 1))
5454
local atenemy = menu:AddComponent(MenuLib.Checkbox("At enemy", true))
5555
local mOldMethod = menu:AddComponent(MenuLib.Checkbox("Old Method", false))
@@ -205,7 +205,6 @@ end
205205

206206
callbacks.Register("FireGameEvent", "exampledamageLogger", damageLogger)
207207

208-
209208
-- define the angle table, evaluation table, and usage table
210209
local predefinedAngles = { 145, -145, 390, -390}
211210
local predefinedEvaluations = { 1, 1, 1, 1 }
@@ -234,9 +233,10 @@ local function createAngleTable()
234233
end
235234
end
236235

236+
lastangle = 0
237237
function randomizeValue()
238238

239-
if not mOldMethod then
239+
if mOldMethod then
240240
-- update evaluationTable by 0.1 for each angle every iteration
241241
if Got_Hit == true then
242242
for i = 1, #evaluationTable do
@@ -336,7 +336,7 @@ else
336336
local highestRated = {}
337337
local highestRating = sortedTable[1].evaluation
338338
for i = 1, #sortedTable do
339-
if sortedTable[i].evaluation == highestRating then
339+
if sortedTable[i].evaluation == highestRating and not lastangle == highestRated then
340340
table.insert(highestRated, sortedTable[i].angle)
341341
else
342342
break
@@ -345,7 +345,7 @@ else
345345

346346
local randomIndex = math.random(1, #highestRated)
347347
local randomValue = highestRated[randomIndex]
348-
348+
lastangle = sortedTable[1].evaluation
349349
-- update the evaluation of the randomly selected angle
350350
for i = 1, #angleTable do
351351
if angleTable[i] == randomValue then
@@ -445,6 +445,13 @@ end
445445

446446
-- OnTickUpdate
447447
local function OnCreateMove(userCmd)
448+
local angle
449+
if mRoll:GetValue() == true then
450+
userCmd:SetViewAngles(EulerAngles( 0, 0, 45):Unpack())
451+
else
452+
userCmd:SetViewAngles(EulerAngles( 0, 0, 0):Unpack())
453+
end
454+
448455
local me = WPlayer.GetLocal()
449456
local pLocal = entities.GetLocalPlayer()
450457
if not pLocal then return end
@@ -721,6 +728,8 @@ end
721728
local function OnUnload() -- Called when the script is unloaded
722729
MenuLib.RemoveMenu(menu) -- Remove the menu
723730
client.Command('play "ui/buttonclickrelease"', true) -- Play the "buttonclickrelease" sound
731+
local angle = EulerAngles( 0, 0, 0)
732+
userCmd.SetViewAngles(angle)
724733
end
725734

726735
client.Command('play "ui/buttonclickrelease"', true) -- Play the "buttonclickrelease" sound

0 commit comments

Comments
 (0)