(Anti)Anti-AFK Script?

Ok, i know this is easy. I just suck at lua.

What i need is something that you put in a value of seconds in. Say, 100.
When that amount of time is up, the character moves back, and then forth, for about a second, to bypass servers Anti-AFK scripts.
Every 100 seconds, it repeats this.
Preferably able to toggle :smiley:

[lua]
function antiafkon(ply, com, arg)
if arg
timer.Create(“anti_afk_timer”,arg, 0, move)
return
end
timer.Create(“anti_afk_timer”,50, 0, move)
end

function antiafkoff(ply, com, arg)
timer.Destroy(“anti_afk_timer”)
end

function move()
RunConsoleCommand("+forward");
timer.Simple(5, RunConsoleCommand, “-forward”)
timer.Simple(10, RunConsoleCommand, “+back”)
timer.Simple(15, RunConsoleCommand, “-back”)
end

concommand.Add( “anti_afk_on”, antiafkon )
concommand.Add( “anti_afk_off”, antiafkoff )
[/lua]

Untested like always

Couldn’t you do something in the console?


alias antiafk "+duck; -duck; wait 100; antiafk;"

Wait doesn’t accept a value
and i think even if you have a gigantic amount of waits you will get stuck in a loop

wait does take one argument (which i assume is the time to wait in milliseconds):eng101:

When you come back, just type this in console



alias antiafk


and it will cancel the loop:wink:

Or you could just type +left and +forward in console.

Well pretty much a copy of what he said.
Just slip this tiny code into your autoexec.cfg:

alias +afk “+duck; wait; -duck; wait; +duck; wait; -duck; +afk”
alias -afk " -duck"

So just go into console and whenever you’re going to go afk, type
+afk
in the console MANUALLY. No binds or anything just type it in the console. And when you’re back, type -afk in the console.
Remember, manually do it yourself, a bind will not work.
This isn’t tested I just wrote some random script I thought would work.
I’m not sure if it will repeat, so try it out.