-
Notifications
You must be signed in to change notification settings - Fork 19
/
Infinite-Food.lua
39 lines (30 loc) · 1.13 KB
/
Infinite-Food.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
--[[
Infinite Food automation
Credits: Baan
Author: LNX (github.com/lnx00)
Dependencies: LNXlib (github.com/lnx00/Lmaobox-Library)
]]
---@type boolean, lnxLib
local libLoaded, Lib = pcall(require, "LNXlib")
assert(libLoaded, "LNXlib not found, please install it!")
assert(Lib.GetVersion() >= 0.89, "LNXlib version is too old, please update it!")
local KeyHelper, Timer, WPlayer = Lib.Utils.KeyHelper, Lib.Utils.Timer, Lib.TF2.WPlayer
local key = KeyHelper.new(KEY_J)
local tauntTimer = Timer.new()
---@param userCmd UserCmd
local function OnUserCmd(userCmd)
local localPlayer = WPlayer.GetLocal()
if not localPlayer then return end
if not localPlayer:IsAlive()
or not key:Down()
or engine.IsGameUIVisible()
then return end
local weapon = localPlayer:GetActiveWeapon()
if weapon:IsShootingWeapon() or weapon:IsMeleeWeapon() then return end
userCmd:SetButtons(userCmd:GetButtons() | IN_ATTACK)
if tauntTimer:Run(0.5) then
client.Command("taunt", true)
end
end
callbacks.Unregister("CreateMove", "LNX_IF_UserCmd")
callbacks.Register("CreateMove", "LNX_IF_UserCmd", OnUserCmd)