• Simple AFK Timer
    38 replies, posted
Hello there! I'm new to lua pretty much. I wanted to start making more helpful tools for gmod. My last tool wasn't too well received, probably because it was poorly thought out. I made sure not to make that same mistake again. I wanted to make something useful that would help servers get rid of idle players taking up their precious slots. So I present to you: AFK Timer. A simple tool that checks if a player is AFK every 10 minutes (This will be changeable in the future.). If the player doesn't hit the okay button, it kicks them. Here are some screenshots of the tool. [t]http://i.imgur.com/78eL2d8.jpg[/t] New design: [t]http://i.imgur.com/xxBYZqu.jpg[/t] I know it isnt much but I plan on adding on to this as my abilities with lua get better I will be adding new customization options to this. [B]Features[/B] 45 Minute AFK Timer. Okayish Design Admin Immunity to afk check ConVars: sv_afktime - The time it takes in minutes for the Checker to show up. The default is 45 minutes. sv_kicktime - The time it takes in seconds for the player to be kicked. Don't set this lower than the afk timer or the addon will not work. sv_kickmessage - The message that shows up when a player is kicked for being afk. [B]Plans:[/B] [del]Better Design[/del] Color chooser for the menu and text built into an admin menu for the tool Admin menu for the tool [del]ConVars so you can set the amount of time on the timer and the kick text.[/del] I uploaded this to the workshop [URL="https://steamcommunity.com/workshop/filedetails/?id=448893073"]here[/URL] You can also download the full addon [URL="http://www.mediafire.com/download/mzvgg8n7nx1ktrt/afktimer.rar"]here[/URL]. I want to improve this simple addon as much as I can while I learn lua, so please give me some feedback. I also know that tools such as ULX have an afk kicker, I wanted one that required the user to click a button to continue.
Not a bad idea I suppose. But, IMO you should detect if they move at all within 10 minutes instead of making them verify they're there. I could see the notice thing getting a bit annoying on build servers among other things.
[QUOTE=wishbone;47798641]Not a bad idea I suppose. But, IMO you should detect if they move at all within 10 minutes instead of making them verify they're there. I could see the notice thing getting a bit annoying on build servers among other things.[/QUOTE] Someone could make a thing to make their player move every couple seconds thus making the afk timer useless. Clicking it makes it prove they are actively there. I also plan on making a configurable timer so build servers can set it for every 30 minutes if they want.
[QUOTE=Vilusia;47798696]Someone could make a thing to make their player move every couple seconds thus making the afk timer useless. Clicking it makes it prove they are actively there. I also plan on making a configurable timer so build servers can set it for every 30 minutes if they want.[/QUOTE] a player can make a five second script to get around ANY anti-afk script there is no good reason to make players click a box when they were not even detected to be afk in the first place there is no good reason to make players click a box at all sorry, this just isn't very useful [lua] local plyafk = {} local seconds = 60*10 timer.Create("SimpleAfkChecker",5,0,function() for k, v in pairs(player.GetAll()) do plyafk[v] = plyafk[v] || {} local oldangs = plyafk[v][2] || v:EyeAngles() plyafk[v][2] = v:EyeAngles() if plyafk[v][2] == oldangs then if CurTime() - plyafk[v][1] >= seconds then v:Kick("AFK") end else plyafk[v][1] = CurTime() end end end) [/lua] this script, in lua/autorun/server, will kick players who don't move their mouse for ten minutes, without bothering them any you could add some networking stuff to warn the player with some onscreen text with a kick countdown timer
Thanks for the feedback, as I said on steam I will be adding this as an option. I want to make a highly customizable afk checker with a variety of options. I will start by making it less intrusive so it's not annoying to the player, then I will move on to add in more options such as the one you suggested. Edit: Here is the current size and position of the AFK timer. I will be touching up the VGUI a bit to make it more pleasing to the eyes. [t]http://i.imgur.com/EI1UjCl.jpg[/t]
Nice! I'm testing on my server
[QUOTE=matiasg90;47802347]Nice! I'm testing on my server[/QUOTE] I would wait. I'm adding some new features that will make it better. [t]http://i.imgur.com/9eR8SxE.jpg[/t] Fixed up the design a little. I'm also just going to make it check every 45 minutes by default. There is no point checking every 10 minutes. New update is now published. Check the OP for links.
you can add immunity to admin? github.com mirror ?
It's already added. :) If a player is admin they will not get the AFK menu.
ULX function with groups? adminvip, moderador, vip, etc etc.. ?
I havent tested it with ULX. Let me test it out. It's still saying I'm immune to the AFK checker when I have ULX installed. I will try to make it so you can add groups for immunity.
I would go with bitches suggestion of using their eye angles, but only use the pitch (looking up down) because you can't modify the pitch using concmds. All other afk-detectable properties such as position and angle yaw can be bypassed by running [I]+forward +right[/I] before going afk (you will run a circle until you do -forward -right).
[QUOTE=wh1t3rabbit;47805189]I would go with bitches suggestion of using their eye angles, but only use the pitch (looking up down) because you can't modify the pitch using concmds. All other afk-detectable properties such as position and angle yaw can be bypassed by running [I]+forward +right[/I] before going afk (you will run a circle until you do -forward -right).[/QUOTE] I enjoy my way better. After thinking about it the way I do it isnt that bad. I will be changing it so the mouse doesn't appear suddenly. I will also be making it so you have to press a key for it to appear. Thanks for the suggestion though!
your way only comes down to "because i prefer being inconvenienced"
[QUOTE=bitches;47805353]your way only comes down to "because i prefer being inconvenienced"[/QUOTE] It's only an inconvenience if the admin setting up the timer makes it that way. I've made it highly changeable so they can make the AFK Timer set for hours if they wanted to. The kick timer can be set just as long as well. I still think view angles are too easy to bot. Thank you for your feedback, bitches. I've taken it into consideration and don't want to do that. I prefer it this way personally. Sorry.
Alright. I made the final design (Hopefully) [t]http://i.imgur.com/xxBYZqu.jpg[/t] This will be updated on workshop and the other link soon-ish. I also made it so it doesn't unlock your cursor when the menu shows up. You press B to do it at anytime now. I also added some ConVars: sv_afktime - The time it takes in minutes for the Checker to show up. The default is 45 minutes. sv_kicktime - The time it takes in seconds for the player to be kicked. Don't set this lower than the afk timer or the addon will not work. sv_kickmessage - The message that shows up when a player is kicked for being afk.
the cursor is not working. vcmod, atm, tab, etc .. Please remove the lock slider (B)
[QUOTE=matiasg90;47809305]the cursor is not working. vcmod, atm, tab, etc .. Please remove the lock slider (B)[/QUOTE] Works fine on my end. [QUOTE=matiasg90;47809305]the cursor is not working. vcmod, atm, tab, etc .. Please remove the lock slider (B)[/QUOTE] Send me an IP to your server so I can see what you are talking about.
and you can not use the default system darkrp? with f3?
[QUOTE=matiasg90;47809847]and you can not use the default system darkrp? with f3?[/QUOTE] It should work fine with that. Let me test it. Tested with DarkRP, works fine.
Pressing the tab and see that the cursor does not work [IMG]http://i.ytimg.com/vi/CWLCaLtKpG0/hqdefault.jpg[/IMG] atm without cursor
You press B for the cursor to appear. Give me the IP for your server and I will assist you. :) Edit: Fixed a check for disconnected players. It should no longer error when they leave.
You should do a question like what's 1+3 or somthing
[QUOTE=Segecos;47811537]You should do a question like what's 1+3 or somthing[/QUOTE] I don't know why you people want to make it more difficult with answering questions and pressing buttons. People should just be able to come back and start moving and it will detect they aren't afk anymore.
[QUOTE=Segecos;47811537]You should do a question like what's 1+3 or somthing[/QUOTE] No. Clicking a button should be enough.
Farewell. It was only an idea
is annoying press the letter b to display the cursor :/
[QUOTE=matiasg90;47817850]is annoying press the letter b to display the cursor :/[/QUOTE] Would you rather the cursor just appear like it did before? That interrupted the player since it makes your screen locked to where ever you are looking. If you are using darkrp you can use f3.
the cursor would have to be visible, and be activated as the default of darkrp f3
[QUOTE=matiasg90;47820454]the cursor would have to be visible, and be activated as the default of darkrp f3[/QUOTE] I've tested it on DarkRP. It works with F3. Are you sure the addon is working on your server? It should say "AFK Timer Version: 1.2 Initialized!" In your console when you start the server. It should also say that you are immune to the AFK Checker in the console as well. If it doesn't say these things then you might not have it set up right.
Sorry, you need to Log In to post a reply to this thread.