Ulysses

Ulysses Stuff => Releases => Ulysses Release Archives => Topic started by: MrPresident on December 21, 2007, 01:55:26 PM

Title: AntiAFK v2.2 - ULib Module
Post by: MrPresident on December 21, 2007, 01:55:26 PM
This script (for GMod10) was completely reworked from the ground up, but it was based on the original idea by Megiddo.(for GMod9)

The idea behind this script is that after a certain time of not moving, you will be flagged as afk. If you continue to be afk, you will be kicked from the server.

This is an addon. Extract it to your Garrysmod/addons folder.

This REQUIRES ULib to be installed to use. ULIB can be downloaded from http://ulyssesmod.net (http://ulyssesmod.net). If you use ULX admin mod, you already have ULib.

~Features~
Ability to change time with console command aafk_time <integer>
Ability to disable the script with aafk_enabled <1/0>
Ability to allow admins immunity to kick with aafk_adminimmune <1/0>
Ability to allow the kicking function to not happen with aafk_kickenabled<1/0>
Ability to shift between allowing afk players to stay on the server and kicking them depending on how full the server is with aafk_kicknumber<integer>

ChangeLog:
v1.0
-Release

v1.10
-Hooks and Timers are client side now, the client checks its own angles instead of the server checking every players angle
-Added in name change support. Whan a player goes afk, their name changes to <AFK>Name and back when they return.
-Added functions to have the client and server side of the script communicate properly with each other.

v1.20
-went partially back to serverside. It was possible to use lua_run_cl to mess up the checks and circumvent the system. Now it is not =)
-Fixed other various bugs.

v1.30
-Simply fixed a bug in 1.2 that was causing the settings not to load correctly.

v2.00
-Major Release
-Added a new variable, aafk_kicknumber will set the server to only kick AFk clients if there are more clients connected to the server than you have the number set to. If there are fewer, it will not kick them.
-Added Names over afk players heads.
-Typing !afk will now flag yourself as afk. Not advised if kick is enabled for you =)
-Chatting as well as view angle will prevent being flagged as afk. Chatting will now bring you out of afk as well.
-Changed: In the notification, if kick is disabled, it will no longer tell the player he/she will be kicked.

v2.1
-Changed some things to make it work with the new Gmod.

v2.2
-Added Access String in the adminimmunity checks. This allows you to give additional groups/users immunity on the fly. See the topic below for how to use.



Immunity Access String Usage.
If you are running ULX (this addon REQUIRES ULib) you can do the following to give an user immunity to the kick if aafk_adminimmunity is on.
ulx userallow <username> "aafk_immune"
This will add the access string "aafk_immune" to their user file and will keep them from being kicked
Also you can edit your data/ULib/groups.txt file and add "aafk_immune" to any groups allow list to give everyone in the group immunity from being kicked.
Please keep in mind that all of this requires aafk_adminimmunity console variable to be set to 1 (on)


~~~~~~~


The way this script works is:
It takes the time you have set in the config (top lines of the .lua file) or if you used aafk_time to set your own in game... and every amount of seconds as defined it checks the players entity angle.. (this is basically where the mouse is pointed) and stores it into a variable for your specific client.
If it finds that you have not changed angles since the last time it checked, and you are not flagged as afk, it will flag you as afk.
If it finds that you have not moved since it last checked and you are already flagged as afk, it will kick you from the server (assuming you have kick enabled)

The default time is 150 seconds.. this allows for around 5-7 minutes of complete afk before being kicked.. depending on how soon after a check you stop moving.


Suggestions for a future version are welcome.. I will try to implement anything that seems worth implementing.

Console Commands:
aafk_enabled <1/0> - Turns aafk on or off (Default On)
aafk_time <integer> - sets the time (in seconds) on the afk check. How often the script checks angles. (Default 150 seconds.. which is 2.5 minutes)
aafk_adminimmune <1/0> - This sets whether or not admins are immune to being kicked for being afk. (Default Off)
aafk_kickenabled <1/0> - Currently no real point in this.. I plan on implimenting more features later that will make use of the player not being kicked but still being flagged as afk.. such as name changing to <afk> Name.. or putting text above their head. (Default On)
aafk_kicknumber <integer> - Setting this number will cause the script to only kick afk users if the current total of players is greater or equal to the number that you set. Good for letting afk players stay connected if the server has less than 5 players connected at the time but keeping afk players from filling slots on a full server.

All of these defaults can be changed in the top of the aafk.lua file
(http://www.garrysmod.org/img/?t=dll&id=29641) (http://www.garrysmod.org/downloads/?a=view&id=29641)

--Old Versions--
(http://www.garrysmod.org/img/?t=dll&id=29618) (http://www.garrysmod.org/downloads/?a=view&id=29618)
(http://www.garrysmod.org/img/?t=dll&id=28211) (http://www.garrysmod.org/downloads/?a=view&id=28211)
(http://www.garrysmod.org/img/?t=dll&id=27951) (http://www.garrysmod.org/downloads/?a=view&id=27951)
(http://www.garrysmod.org/img/?t=dll&id=27876) (http://www.garrysmod.org/downloads/?a=view&id=27876)
Title: Re: AntiAFK v1.1 - ULib Module
Post by: MrPresident on December 25, 2007, 08:50:58 AM
New version.. 1.1

-Now all of the meaty checks are client side. Less strain on the server.
-AFK users are announced and given an <AFK> tag on their name, which is removed as SOON as you move.
-Added new functions to let clientside scripting perform serverside operations. (just console commands :))
Title: Re: AntiAFK v1.1 - ULib Module
Post by: blacksythe on December 25, 2007, 12:01:19 PM
another one of your modules on my server keep up the good work zak
Title: Re: AntiAFK v1.1 - ULib Module
Post by: JamminR on December 25, 2007, 04:26:33 PM
Good work Zakap!

-Added new functions to let clientside scripting perform serverside operations. (just console commands :))

I haven't looked at the code, but make sure your client commands code gets checked on the serverside to make sure whatever player is sending the commands has appropriate access, or just listens for expected client commands.
Someone could use this as an exploit if they knew just enough lua to change the client side code.

If I'm totally mis-understanding what you're meaning, my apologies.
Title: Re: AntiAFK v1.1 - ULib Module
Post by: MrPresident on December 25, 2007, 05:09:16 PM
Yeah, they cant change the commands, those are server side. The only commands that could possibly be exploited are the kick command, but it only kicked the player who uses it... so if they figured out how to pass correct parameters to it, it would just kick them. Also, there is something that sends messages to players, which might be annoying, but i don't see how it could be exploited. I'll look into a better way of communicating from client to server.. but the only way I can think of is a timer or a think hook which is what I was trying to avoid by going clientside in the first place. So if I cant find a way, I may just revert the script checking back to server side.

Going to parents house for Christmas.. I'll work on it later.

Merry Christmas guys.
Title: Re: AntiAFK v1.1 - ULib Module
Post by: JamminR on December 25, 2007, 05:55:19 PM
Yeah, they cant change the commands, those are server side.
<clip>
, but it only kicked the player who uses it... so if they figured out how to pass correct parameters to it, it would just kick them.
Great! I was just checking.

Also, there is something that sends messages to players, which might be annoying, but i don't see how it could be exploited. I'll look into a better way of communicating from client to server

Not a big need. I wouldn't be concerned with server=>client commands too much.


Merry Christmas guys.

You too!
Title: Re: AntiAFK v1.3 - ULib Module
Post by: MrPresident on December 25, 2007, 09:07:17 PM
Sorry.. ANOTHER update.. but that's good isn't it?!

We found out that using it client side to check the angles was easily exploitable.. so.. I made that part server side again. It still uses a client side think to detect when you come back from afk.. but it should not be exploitable any more.. if it is.. I'll fix it and release a new version.. ha!

(http://www.garrysmod.org/img/?t=dll&id=27951) (http://www.garrysmod.org/downloads/?a=view&id=27951)

Title: Re: AntiAFK v2.00 - ULib Module
Post by: Avien on January 19, 2008, 06:35:43 PM
Does this work with the new update?
Title: Re: AntiAFK v2.00 - ULib Module
Post by: JamminR on January 19, 2008, 08:37:28 PM
I saw an AFK script working on Beast Build server. I believe Will the host got it from here.
Might want to test for yourself though.
Title: Re: AntiAFK v2.00 - ULib Module
Post by: MrPresident on January 19, 2008, 09:40:44 PM
There is no reason this shouldn't work with the new version. It may not change their name due to the blocks in the con commands again. But everything else about it should work fine. =)

I'll test it out and give you a definate answer though tonight.


edit:

Confirmed. Works all except for the name changing, which Garry has blocked as of current.
Title: Re: AntiAFK v2.00 - ULib Module
Post by: spbogie on January 20, 2008, 01:18:37 AM
Garry hasn't blocked name changing, it's just that the name command no longer changes your name. With the new engine, your name is now pulled from Friends (just like in tf2). If you want, you can still temporarily change your name with "setinfo name <new_name>".
Title: Re: AntiAFK v2.00 - ULib Module
Post by: MrPresident on January 20, 2008, 02:48:11 AM
Thanks boogie.. I'll patch this up! =)
Title: Re: AntiAFK v2.1 - ULib Module
Post by: MrPresident on January 21, 2008, 05:16:55 AM
Patched.

I'm pretty sure I've ironed out all the issues caused by the update..
Title: Re: AntiAFK v2.1 - ULib Module
Post by: Avien on January 21, 2008, 09:03:22 AM
Question regarding admin check.  I made a few groups that i want to be immune from the kicking feature of this addon. Does this addon support the use of pl:IsUserGroup( "custom") if i added it to the admin check part, lines 29-40?

example:
Code: [Select]
If pl:IsUserGroup( "owner" ) then
return true
end
Title: Re: AntiAFK v2.1 - ULib Module
Post by: spbogie on January 21, 2008, 09:07:10 AM
Yes, assuming you change pl to ply so it matches the player object it was passed.

Edit: No, nevermind, the AdminCheck at the top if for access to changing the convars. The admin check for kicking is hardcoded further down.

zakap, this is a feature you may want to add. Another function at the top called immuneCheck or even better, an access string such as "aafk_immune". The function for registering an access string is ULib.ucl.registerAccess (http://ulyssesmod.net/docs/files/lua/ULib/server/ucl-lua.html#ULib.ucl.registerAccess). Then you can check for it with ULib.ucl.query (http://ulyssesmod.net/docs/files/lua/ULib/shared/sh_ucl-lua.html#ULib.ucl.query)(or ply:query). With inheritance, setting the default group to admin will also apply it to superadmin, and it's rather easy for anyone to add it to any other group, or individual player.
Title: Re: AntiAFK v2.1 - ULib Module
Post by: MrPresident on January 21, 2008, 09:18:25 AM
the only way you could do it currently would be to hard code it yourself.. just add this.

where it says
Code: [Select]
if v:IsAdmin() == true then
change to

Code: [Select]
if v:IsAdmin() == true or v:IsUserGroup("group") == true or v:IsUserGroup("group") == true then
adding as many groups as you need to with more or conditions.

I'll probably add this feature to a future version.
Title: Re: AntiAFK v2.1 - ULib Module
Post by: Avien on January 21, 2008, 09:45:29 AM
So i would add this under the superadmin line?  The thing is i have my groups being inherited from the superadmin group, so do i even need to add my custom groups?
Title: Re: AntiAFK v2.1 - ULib Module
Post by: MrPresident on January 21, 2008, 09:51:02 AM
IsAdmin will return true for all groups that inherit Admin. Superadmin inherits admin by default, unless you've changed it.

However, one thing I am not sure of... I dont know if IsAdmin will return true for any groups inheriting the superadmin group.. I dunno if it passes that inheritance that far.


If all of the groups you want to be immune are superadmin or inherited from the superadmin just change that IsAdmin line to IsSuperAdmin.


I'm working on a new system for exclusions. (thanks to spbogie for the suggestion) It'll make your life a lot easier. shouldn't take too long to impliment, just sit tight for about 10-15 minutes =)
Title: Re: AntiAFK v2.1 - ULib Module
Post by: spbogie on January 21, 2008, 09:54:01 AM
If they are inheriting from SuperAdmin then there should be no need to add anything.
Title: Re: AntiAFK v2.1 - ULib Module
Post by: MrPresident on January 21, 2008, 10:06:48 AM
(http://www.garrysmod.org/img/?t=dll&id=29641) (http://www.garrysmod.org/downloads/?a=view&id=29641)

v2.2
-Added Access String in the adminimmunity checks. This allows you to give additional groups/users immunity on the fly. See the topic below for how to use.

Immunity Access String Usage.
If you are running ULX (this addon REQUIRES ULib) you can do the following to give an user immunity to the kick if aafk_adminimmunity is on.
ulx userallow <username> "aafk_immune"
This will add the access string "aafk_immune" to their user file and will keep them from being kicked
Also you can edit your data/ULib/groups.txt file and add "aafk_immune" to any groups allow list to give everyone in the group immunity from being kicked.
Please keep in mind that all of this requires aafk_adminimmunity console variable to be set to 1 (on)


Additional comments on the access string usage.

ulx userallow <user> "aafk_immune" 1    - this will remove a previously given acess to immunity
ulx userdeny <user> "aafk_immune" - this will make it to where someone who is in a group who has this flag by default will not receive it.
ulx userdeny <user> "aafk_immune" 1 - This will make it to where someone who is in a group who has this flag but had it taken away with userdeny will receive the flag again by default.


confusing? sorry =)
Title: Re: AntiAFK v2.2 - ULib Module
Post by: Sc00by22 on April 23, 2008, 12:01:25 PM
Where is the download?

EDIT : found 2.3 on garrysmod

(http://www.garrysmod.org/img/?t=dll&id=30277) (http://www.garrysmod.org/downloads/?a=view&id=30277)
Title: Re: AntiAFK v2.2 - ULib Module
Post by: MrPresident on April 23, 2008, 12:03:19 PM
It would seem that gmod.org has pushed the file out. I'm actually working on a new one now, it'll be done in the next couple of days or so.

edit: Oh.. 2.3 is the latest, I had just forgot to add it to these forums. But like I said I'm workong on a better/newer rewrite.
Title: Re: AntiAFK v2.2 - ULib Module
Post by: Megiddo on April 23, 2008, 12:13:51 PM
Good work MrPresident!
Title: Re: AntiAFK v2.2 - ULib Module
Post by: MrPresident on April 23, 2008, 12:32:21 PM
heh, thanks. 2.3 is old. January 23rd. All I added from 2.2 was some movement checks. There have been a few GMod updates since this addon, and looking back at the code, it's very poorly coded, seeing as this was the first project and I learned as I went. I've learned a few new tricks since then and the newer version is looking a lot better than these ones. I'll definitely post here when it's done.
Title: Re: AntiAFK v2.2 - ULib Module
Post by: Sc00by22 on May 09, 2008, 03:24:11 PM
Any update on the new one?
Title: Re: AntiAFK v2.2 - ULib Module
Post by: MrPresident on May 09, 2008, 08:15:34 PM
slow =) I'll post here when I finish it =)
Title: Re: AntiAFK v2.2 - ULib Module
Post by: Sc00by22 on May 10, 2008, 01:09:14 AM
Can we change the Autokick Message?
Title: Re: AntiAFK v2.2 - ULib Module
Post by: MrPresident on May 10, 2008, 12:28:41 PM
Yes, just change the lua. You should see the line where it has the message.
Title: Re: AntiAFK v2.2 - ULib Module
Post by: Enrico42 on September 24, 2008, 01:46:55 PM
Please re up this plugin is cool !!!!!!!!!!!!
Title: Re: AntiAFK v2.2 - ULib Module
Post by: JamminR on September 24, 2008, 06:10:12 PM
Please re up this plugin is cool !!!!!!!!!!!!

Enrico, the author of this plugin is currently in the military and can't reupload it.
Perhaps WildWill still uses the latest version, and can attach it here?
Title: Re: AntiAFK v2.2 - ULib Module
Post by: WildWill on September 24, 2008, 06:30:45 PM
I only have 2.1 but I'll upload it if you like.
Title: Re: AntiAFK v2.2 - ULib Module
Post by: Megiddo on September 24, 2008, 06:37:16 PM
Does garry auto-delete stuff or what?
Title: Re: AntiAFK v2.2 - ULib Module
Post by: Enrico42 on September 25, 2008, 06:20:51 AM
i find 2.3 on garrysmod thx m.president have edit your post

thx all
Title: Re: AntiAFK v2.2 - ULib Module
Post by: WildWill on September 25, 2008, 08:19:40 AM
I went and found it, here's the link to the new one.


Title: Re: AntiAFK v2.2 - ULib Module
Post by: MrPresident on October 03, 2008, 09:46:50 PM
Thanks Will.. I currently dont have my personal computer here so I dont have access to any of my addons or old files. I wont have them until I go home for christmas exodus.
Title: Re: AntiAFK v2.2 - ULib Module
Post by: Sc00by22 on October 15, 2008, 01:55:24 PM
Could anybody update it for a ignore player table? So I can add steamids and it will also immune those players from the kicking.
Title: Re: AntiAFK v2.2 - ULib Module
Post by: JamminR on October 15, 2008, 06:44:07 PM
Could anybody update it for a ignore player table? So I can add steamids and it will also immune those players from the kicking.

v2.2
-Added Access String in the adminimmunity checks. This allows you to give additional groups/users immunity on the fly. See the topic below for how to use.

Immunity Access String Usage.
If you are running ULX (this addon REQUIRES ULib) you can do the following to give an user immunity to the kick if aafk_adminimmunity is on.
ulx userallow <username> "aafk_immune"
This will add the access string "aafk_immune" to their user file and will keep them from being kicked
Also you can edit your data/ULib/groups.txt file and add "aafk_immune" to any groups allow list to give everyone in the group immunity from being kicked.
Please keep in mind that all of this requires aafk_adminimmunity console variable to be set to 1 (on)
Title: Re: AntiAFK v2.2 - ULib Module
Post by: Sc00by22 on October 15, 2008, 11:47:51 PM
Ahh, Didn't see that, Thanks
Title: Re: AntiAFK v2.2 - ULib Module
Post by: someone920 on July 17, 2010, 04:30:13 PM
Know it's been a long time since anyone's used this or talked about it, but does this still work, and does it work with ULX SVN?
Title: Re: AntiAFK v2.2 - ULib Module
Post by: JamminR on July 17, 2010, 04:35:14 PM
October 2008 was pre 'new svn' command structure. I'd say not.
However, MrPresident is coming home soon and has been active lately.
Perhaps he'll pick up the project again and convert it.

If we ever release again (pokes at SticklyMan), I plan on converting some of the popular (and or easy to convert) releases to the new command structure.
Title: Re: AntiAFK v2.2 - ULib Module
Post by: someone920 on July 17, 2010, 04:47:16 PM
ohh, okay, thanks :D
Title: Re: AntiAFK v2.2 - ULib Module
Post by: MrPresident on July 18, 2010, 02:54:39 AM
Yeah, once I get home in a few weeks I'll have time to do things like this. This as well as my warning module were always things I wanted to pick back up and redo, particularly for the new ULX version/SVN.

I bet this code is horrendous. This was my very first lua script ever.. lol.



edit: (after looking at the code) HAHAHA... yeah... this is going to get redone... I just need to learn a tad about the SVN of ULX, though I plan on making it work without ULib too. Having ULib would allow you to have added functionality, namely the Access strings that ULib provides.
Title: Re: AntiAFK v2.2 - ULib Module
Post by: LuaTenshi on July 06, 2011, 04:25:42 AM
Yeah, once I get home in a few weeks I'll have time to do things like this. This as well as my warning module were always things I wanted to pick back up and redo, particularly for the new ULX version/SVN.

I bet this code is horrendous. This was my very first lua script ever.. lol.



edit: (after looking at the code) HAHAHA... yeah... this is going to get redone... I just need to learn a tad about the SVN of ULX, though I plan on making it work without ULib too. Having ULib would allow you to have added functionality, namely the Access strings that ULib provides.

(Yes Forum Bot I want to reply.) So where is the new remade version?
Title: Re: AntiAFK v2.2 - ULib Module
Post by: MrPresident on July 07, 2011, 09:44:29 AM
Wow, resurrecting this one from the dead are we?

I don't have the new one anymore, and even if I did, it would be terribly depreciated. This is on my list of things to do but probably never will though.
Title: Re: AntiAFK v2.2 - ULib Module
Post by: Wully616 on January 13, 2013, 01:51:50 PM
(http://i.imgur.com/KtY5j.png)
Hello,

Does anyone having a working version of this, or would be able to help with this error were having with the addon on our build server?
Title: Re: AntiAFK v2.2 - ULib Module
Post by: JamminR on January 13, 2013, 02:13:25 PM
Did you seriously expect this to work?
The fact you attempted to install an addon last updated in 2008, and last post was in 2011, makes me question ... oh, never mind.

Perhaps the original author might update it.
http://forums.ulyssesmod.net/index.php/topic,5842.msg27205.html#msg27205
Title: Re: AntiAFK v2.2 - ULib Module
Post by: SuperAero_ on January 13, 2013, 02:47:26 PM
Could this be updated for gmod 13?
Title: Re: AntiAFK v2.2 - ULib Module
Post by: JamminR on January 13, 2013, 06:31:06 PM
Could this be updated for gmod 13?
Perhaps the original author might update it.
http://forums.ulyssesmod.net/index.php/topic,5842.msg27205.html#msg27205
Title: Re: AntiAFK v2.2 - ULib Module
Post by: MrPresident on January 13, 2013, 06:31:22 PM
Well.... I have recently resurrected 2 of my previous addons.. I might give this one a look too.. check back in a couple days.
Title: Re: AntiAFK v2.2 - ULib Module
Post by: MrPresident on January 13, 2013, 11:10:22 PM
New version for GM13 - Enjoy!
http://forums.ulyssesmod.net/index.php/topic,5963.0.html