Home » Renegade Discussions » Mod Release Forum » [SSGM+BRenBot Plugin] AFK Detector v2.0
[SSGM+BRenBot Plugin] AFK Detector v2.0 [message #450218] |
Wed, 27 July 2011 17:27 |
iRANian
Messages: 4308 Registered: April 2011
Karma: 0
|
General (4 Stars) |
|
|
This plugin is an AFK detector for SSGM, with a plugin for BRenBot (although other bots using renlog can be made to support it). It checks whether someone is AFK via both their score and their position. Inside afk_detection.ini you can configure the waiting time (interval) before a new AFK check and the amount of score that needs to be gained in between check intervals for a player not to be marked as AFK (this is the 'score_threshold' setting).
The plugin doesn't do anything when there's only one player in-game. There's an option to disable checking score if Power Plant and/or Refinery is down. And an option to PM a player if he's marked AFK (but it won't do any kicking).
The plugin marks a player AFK during a check when first:
-He hasn't gained points (with the threshold logic taken in account and the option to disable checking points when PP/Ref is destroyed).
-When his position hasn't changed within a small renefeet threshold.
-If his facing hasn't changed.
And if he doesn't do any of the following:
-When he hasn't fired any shots.
-Doesn't speak.
-Doesn't enter or exit a vehicle.
-Doesn't purchase anything.
The plugin outputs the following at most to renlog (the BRenBot plugin relays this to the admin channel), this is what's shown when EVERYTHING hasn't changed:
[AFK] PLAYER's score(X, count: X) position(count: X, near BUILDING) shots fired with infantry(count: X) facing(count X) hasn't changed.
Another example:
[AFK] PLAYER's position(count: X, near Power Plant) score (X, count: X) facing(count: X) shots fired(count: X) hasn't changed.
Where 'PLAYER' is a player name, 'count' is the count of consecutive times that score or position haven't changed (this means they get reset if position/score change appropriately). 'BUILDING' is the name or acronym of the building they're closest too, if it's the same team as the player. And where 'X' is a number.
Installation:
1. Edit afk_detector.ini to your liking.
2. Place afk_detector.ini and afk_detector.dll inside your FDS folder (where SSGM is located in).
3. Edit SSGM.ini and add an entry for 'afk_detector' under the [Plugins] section of that file.
Optionally, to add BRenBot support:
4. Place afk_detector.xml and afk_detector.pm inside the BRenBot\plugins folder.
Credits:
Reborn (the guy) - The 'closest building to player' logic is taken from his commander plugin.
(gen)Blacky - Based the BRenBot plugin on something similar he made.
zunnie - Helped me find a scripts.dll function I needed.
[Updated on: Thu, 25 August 2011 18:18] Report message to a moderator
|
|
|
|
|
Re: [SSGM+BRenBot Plugin] AFK Detector [message #450235 is a reply to message #450218] |
Thu, 28 July 2011 12:44 |
iRANian
Messages: 4308 Registered: April 2011
Karma: 0
|
General (4 Stars) |
|
|
Thanks for the suggestion, I didn't think about using facing. I appreciate the feedback, three issues with them though:
1. Ssometimes when you alt+tab out, you keep rotating.
2. The size of the AFK detection message sent to IRC/written to Renlog, when score and positioned haven't changed and the guy is standing near a building, the message already is quite big imo.
3. I'm not sure if it's effective at all, when walking while alt+tabbed isn't an issue, when someone is standing still for 5-10 minutes it's likely he's AFK (especially if you get another AFK message for the guy during the next check). It's reasonable that someone is AFK repairing if their position doesn't change but their score does and they're located near the same building every check.
I'm not using ammo count, however the engine keeps a count of shots fired, I could keep track of that info (and the facing) too, I'll have to refactor the AFK detection messages output to be more concise, any suggestions? I'm also thinking about checking if a player's credits have decreased if their score hasn't. Anything else that would be wise to check?
For the AFK detection messages, what about (with all of these being optional):
[AFK] PLAYER's score(X, count: X) position(count: X, near BUILDING) shots fired(count: X) facing(count X) credits decreased(count X) changed.
[Updated on: Thu, 28 July 2011 13:00] Report message to a moderator
|
|
|
|
|
Re: [SSGM+BRenBot Plugin] AFK Detector [message #450296 is a reply to message #450281] |
Fri, 29 July 2011 11:32 |
|
Gen_Blacky
Messages: 3250 Registered: September 2006
Karma: 1
|
General (3 Stars) |
|
|
Points are a bad way to detect if someone afk with 100 point threshold.
Games where each side only has a power plant or a ref. You could spend 15 mins fighting with free chars and not get 100 points.
If the player score hasn't changed at all after so long check afk and then check again.
Its rather hard to detect afk people because when people alt tab they could being pressing a button , running , spinning.
I like your ideas.
[Updated on: Fri, 29 July 2011 11:38] Report message to a moderator
|
|
|
Re: [SSGM+BRenBot Plugin] AFK Detector [message #450297 is a reply to message #450218] |
Fri, 29 July 2011 12:11 |
iRANian
Messages: 4308 Registered: April 2011
Karma: 0
|
General (4 Stars) |
|
|
Yeah that's an issue with the threshold logic. The script gets destroyed and created again after you die so the timer for it should also get reset when that happens, though.
I could play around with the logic so it doesn't give score messages or disables the threshold if PP/Ref are destroyed.
[Updated on: Fri, 29 July 2011 12:13] Report message to a moderator
|
|
|
|
|
Re: [SSGM+BRenBot Plugin] AFK Detector [message #451202 is a reply to message #450218] |
Wed, 10 August 2011 14:35 |
iRANian
Messages: 4308 Registered: April 2011
Karma: 0
|
General (4 Stars) |
|
|
Getting the amount of shots fired does work for Repair Guns, it's something the engine itself keeps (it's the 'ShotsFired' int member of cPlayer), and I checked if it counts firing the Repair Guns with that, and it does.
I'm gonna release a new version of this script once I'm finished with my server-side map fixes pack.
[Updated on: Wed, 10 August 2011 14:37] Report message to a moderator
|
|
|
|
|
Re: [SSGM+BRenBot Plugin] AFK Detector [message #452423 is a reply to message #450218] |
Wed, 24 August 2011 12:13 |
iRANian
Messages: 4308 Registered: April 2011
Karma: 0
|
General (4 Stars) |
|
|
Alright, I'm thinking about adding the following:
-Don't do anything when there's only one player in-game.
-Add an option to disable checking score if Power Plant and/or Refinery is down.
-Add an option to PM a player if he's marked AFK (but don't do any kicking)
Have the code mark a player AFK during a check when first:
-He hasn't gained points (with the threshold logic taken in account and the option to disable checking points when PP/Ref is destroyed).
-When his position hasn't changed within a small renefeet threshold.
-If his facing hasn't changed.
And if he doesn't do any of the following:
-When he hasn't fired any shots.
-Doesn't speak.
-Doesn't enter or exit a vehicle.
-Doesn't purchase anything.
Then write to Renlog and relay with BRenbot facing/score/shotsfired/position for all of those that haven't changed. Looking like this:
[AFK] PLAYER's score(X, count: X) position(count: X, near BUILDING) shots fired with infantry(count: X) facing(count X) hasn't changed.
[Updated on: Thu, 25 August 2011 03:59] Report message to a moderator
|
|
|
|
Goto Forum:
Current Time: Fri Dec 20 05:29:25 MST 2024
Total time taken to generate the page: 0.01005 seconds
|