metastruct-experiments/afk_hook.glua
Ayane Satomi e7503545df
Include Google TTS v4
Signed-off-by: Ayane Satomi <ayane@vignetteapp.org>
2022-12-17 00:24:44 +08:00

22 lines
No EOL
603 B
Text

-- This should be added either as a autorun
-- or on your own outfit.
local away = false
hook.Add("AFK", "pac_afk", function(pl, afk)
if pl and pl == LocalPlayer() and afk then
LocalPlayer():ConCommand("pac_event afk 1")
else
LocalPlayer():ConCommand("pac_event afk 0")
end
end)
hook.Add("Think", "pac_away", function()
if not away and not system.HasFocus() then
away = true
LocalPlayer():ConCommand("pac_event away 1")
end
if away and system.HasFocus() then
away = false
LocalPlayer():ConCommand("pac_event away 0")
end
end)