Anti-Afk Script

Can anyone write me a lua script with a console command “Antiafk_enabled 1”. and when you enable it, you run in a small circle. Thanks guys :smiley: im using it for my Dark RP server, Since im the owner. it’s not gonna matter (im not using for any purpose in-game other than to not get kicked for inactivity (i have a custom lua coded admin,hard to explain.) thanks guys

EDIT: I’m testing with my scriptenforcer, and with my admins anti-afk script finder. thnx

It would probably be a ton easier to make your anti-afk script not kick you.




So you want us to try making a script that can be used to cheat your afk script?

Or some thing easier. Get something heavy and small and put it on your forward key. Voila, anti afk script.

In a sense, i’ve been looking for a way to break it now for a while. +left;cl_yawspeed is a command you are unable to use (the admin system blocks it) and just using w is not a script, i am testing with my servers security.


and, i don’t want it to just not kick ME because then i can’t test with it, ill have it set that way sooner or later when all problems are resolved.

Well then how about seeing if it works if it does, do

[lua]-- function name
if ply:IsAdmin() then return false
– your code[/lua]

in the top of your afk-kicker script.

100th post :smiley:


Hi, there is a search button if it’s not on the forum’s i’m sure it’s on the website, if not then post.


He wasn’t looking for an afk kicker.

Ops lol.

I just need it so when i enable it, it makes me run in a small circle, it can be simple as hell i just need a command to start it and a script to make me run in the circle :smiley:

[editline]6:34 PM[/editline]

if you want to make it complex that would be great, but for now im “having my admin system sniff out different lua files being ran” as said by the creator of the personal admin system

with +forward in the console…and it can’t be blocked because if it was blocked then you wouldn’t be able to move

function derrrnotafk ()
RunConsoleCommand("+turnleft") --might not be the correct name of the command for turning left
concommand.Add( “antiafk”, derrrnotafk )

function derrrback ()
concommand.Add( “Imback”, derrrback )


Oh well i didn’t set up my server… Maybe he meant something else by +left… sorry for my n00bness, we all have to start somewhere right? thanks for that. and im pretty sure that: [lua]

would really be

RunConsoleCommand("+left;cl_yawspeed 175")

Am i right? because i can manually go replace them.

Or you could just type that in the console yourself, or bind it to a key. No need to use lua for that stuff.

Well the reason i want it is so i can just bind a key to “imback” then it does it. i thought it would be alot easier, and alot faster then binding 2 keys for those.

[editline]8:14 PM[/editline]

BTW! is it antiafk to start then imback to stop?

I got a better idea
function ImNotAFK(pl, command, Args)
if (Args[1]) == 1) then
print(“Avoiding AFK.”)
RunConsoleCommand("+forward") – To run forward
RunConsoleCommand("+left") – To turn left
elseif (Args[1] == 0) then
print(“No longer avoiding AFK.”)
RunConsoleCommand("-forward") – To stop running forward
RunConsoleCommand("-left") – To stop turning left
print(“Input takes boolean argument.”)
concommand.Add(“AntiAFK_Enabled”, ImNotAFK)

alias goafk "echo Starting anti-AFK.; +forward; +left; alias antiafk endafk"
alias endafk "echo Stopping anti-AFK.; -forward; -left; alias antiafk goafk"
alias antiafk goafk
bind "key" "antiafk"

Much simpler and will work on servers with ScriptEnforcer enabled.

Put into a cfg?

Replace “key” with the key you want to bind it to, remember it’s a toggle. Copy-paste the snippet to autoexec.cfg.