Author Topic: AAFK V_3.1 : Anti-AFK system for Garry's Mod  (Read 113619 times)

0 Members and 1 Guest are viewing this topic.

Offline ChaosWolf

  • Jr. Member
  • **
  • Posts: 94
  • Karma: 2
  • "The Exiled One's" Server Owner
Re: AAFK V_3.1 : Anti-AFK system for Garry's Mod
« Reply #75 on: August 24, 2014, 01:43:38 AM »
that wasn't my intention, the user in most gamemodes is given the option as to which team to join, if unselected even, their team is considered unassigned.

that's not to rebuttal your point however, I agree completely but I still think its a good idea to first move to spectator then kick, but in contrast its not universal so again, your right. perhaps I should have fully considered that before reinforcing ghost's point.
"Someone once told me, scripting lua is like trying to build a rocket ship, once your finished with it and think your done, you start it up only to realize you had just built it upside down." ~Programmer

Offline H3llGhost

  • Newbie
  • *
  • Posts: 9
  • Karma: 1
Re: AAFK V_3.1 : Anti-AFK system for Garry's Mod
« Reply #76 on: August 24, 2014, 03:41:12 AM »
Hum guys, I don't understand your discussion. JamminR you are right, time is limited and finally I am not afraid of touching the code myself. But I am missing a source code repository or similar.

It is an interesting point I never thought that so much game modes have no spectator.

Offline Mates

  • Newbie
  • *
  • Posts: 8
  • Karma: 0
Re: AAFK V_3.1 : Anti-AFK system for Garry's Mod
« Reply #77 on: August 24, 2014, 03:48:19 AM »
Maybe there is some "universal" way to detect whether or not current gamemode supports spectator? Then it could either kick to spectator if so and if it's enabled in the config, or ignore it alltogether and simply kick.

Offline H3llGhost

  • Newbie
  • *
  • Posts: 9
  • Karma: 1
Re: AAFK V_3.1 : Anti-AFK system for Garry's Mod
« Reply #78 on: August 24, 2014, 03:56:01 AM »
Maybe there is some "universal" way to detect whether or not current gamemode supports spectator? Then it could either kick to spectator if so and if it's enabled in the config, or ignore it alltogether and simply kick.

There is no universal way to detect something like that.
« Last Edit: August 24, 2014, 04:25:28 AM by H3llGhost »

Offline H3llGhost

  • Newbie
  • *
  • Posts: 9
  • Karma: 1
Re: AAFK V_3.1 : Anti-AFK system for Garry's Mod
« Reply #79 on: August 24, 2014, 04:34:00 AM »
So in the meanwhile I have written a small "detection" how I would handle the spectator thing:
Code: [Select]
if ( GetConVarNumber( "ulx_afk_spectator_allowed" ) ) and pl.afkc >= GetConVarNumber( "ulx_afk_specminutes" ) then
if pl.spec == false then
pl.spec = true
pl.afkc = 0
hook.Run( "UlxAfkMoveToSpectator", pl )
end
end

There is a new flag added to the player table to prevent duplicate moving to spectator.
A hook Run for the move logic. It is missing a check if there is a hook available otherwise disable move to spectator mode.

Perhaps it would be better to use hook.call but I don't know the differences yet.
Here a simple implementation of a hook using TTT commands:

Code: [Select]
//THIS MODULE ONLY WORKS WITH TTT
if GAMEMODE.Name = "Trouble in Terrorist Town" then

function ulx.AFKMove_to_Spectator_TTT( pl )
if pl.afk == false then return end

if not IsValid( pl ) then return end
if not pl:IsConnected() then return end
ulx.ResetAFKStatus( pl )
ULib.consoleCommand( "ulx fspec " .. pl.name )
end
hook.Add("UlxAfkMoveToSpectator", "AFKMove_to_Spectator_TTT", ulx.AFKMove_to_Spectator_TTT)

end

It is not tested at all, but in general I think it is a good start. :)

Offline ChaosWolf

  • Jr. Member
  • **
  • Posts: 94
  • Karma: 2
  • "The Exiled One's" Server Owner
Re: AAFK V_3.1 : Anti-AFK system for Garry's Mod
« Reply #80 on: August 24, 2014, 04:58:00 AM »
I can plug it in to my afk and see if it works for you. gimme just a minute to finish some updates and ill have an answer for you tomorrow at the latest 12 hours. I have a server that supports spectator and one that does not.
"Someone once told me, scripting lua is like trying to build a rocket ship, once your finished with it and think your done, you start it up only to realize you had just built it upside down." ~Programmer

Offline H3llGhost

  • Newbie
  • *
  • Posts: 9
  • Karma: 1
Re: AAFK V_3.1 : Anti-AFK system for Garry's Mod
« Reply #81 on: August 24, 2014, 04:59:59 AM »
Don't test it, it isn't finished for testing. If you want I will finish it.

Offline ChaosWolf

  • Jr. Member
  • **
  • Posts: 94
  • Karma: 2
  • "The Exiled One's" Server Owner
Re: AAFK V_3.1 : Anti-AFK system for Garry's Mod
« Reply #82 on: August 24, 2014, 06:08:42 AM »
oh, I would like you to finish it. preferably at these hours, from now to 4 hours from now, is when I do server maintanence. I would much rather not test it during operating hours. however if its slow today I can throw up a mock server to run it on. otherwise it will have to wait. the sooner you finish it the sooner I can get started. If I feel the need to make some adjustments in the script I will be sure to indicate exactly what I did to make it work on my server's gamemodes, which support sandbox, TTT, Prop hunt, murder, and dark RP. I will make a report on how it reacts to each if you would like.
"Someone once told me, scripting lua is like trying to build a rocket ship, once your finished with it and think your done, you start it up only to realize you had just built it upside down." ~Programmer

Offline punkbeech1

  • Newbie
  • *
  • Posts: 7
  • Karma: 0
Re: AAFK V_3.1 : Anti-AFK system for Garry's Mod
« Reply #83 on: October 06, 2014, 07:35:00 AM »
hey, quick stupid question, does this work for prop hunt? ive tired it on my server and its not working. So im assuming that it only works for TTT?

Offline Shalmendo

  • Newbie
  • *
  • Posts: 36
  • Karma: 1
Re: AAFK V_3.1 : Anti-AFK system for Garry's Mod
« Reply #84 on: November 18, 2014, 11:24:32 AM »
I hate to be a problem, but I'm having a bit of trouble with the ignore admins option. It doesn't seem to be working. As a superadmin in ULX I keep getting booted from the server, despite the fact I've restarted the server a few times, and made sure the line ulx_afk_ignoreadmins 1 is set in the server.cfg.

Any idea what I need to look at to determine what I did wrong? We're not getting any errors as far as I Can tell.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: AAFK V_3.1 : Anti-AFK system for Garry's Mod
« Reply #85 on: November 18, 2014, 12:55:34 PM »
This is an old script. It could be something in gmod code that changed or a conflicting add-on that you have installed.

Offline Shalmendo

  • Newbie
  • *
  • Posts: 36
  • Karma: 1
Re: AAFK V_3.1 : Anti-AFK system for Garry's Mod
« Reply #86 on: November 18, 2014, 02:19:44 PM »
This is an old script. It could be something in gmod code that changed or a conflicting add-on that you have installed.

Well unfortunately I'm not skilled with LUA to update it. If you could look into it and see about updating your script, I'd really appreciate it! Of course you don't have to, you're doing this for free afterall, so thanks for making it, and answering me, I appreciate it!

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: AAFK V_3.1 : Anti-AFK system for Garry's Mod
« Reply #87 on: November 18, 2014, 08:07:00 PM »
a conflicting add-on that you have installed.
He can't fix that.
Only you can fix that by figuring out which one, and removing it/talking to it's developers.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Shalmendo

  • Newbie
  • *
  • Posts: 36
  • Karma: 1
Re: AAFK V_3.1 : Anti-AFK system for Garry's Mod
« Reply #88 on: November 19, 2014, 02:57:59 PM »
He can't fix that.
Only you can fix that by figuring out which one, and removing it/talking to it's developers.

Thank you for the clarification!

As an update, it turns out it was a mild config problem with the way the manager script was affecting the way the cfg files worked. I adapted to the way the script manages it and it's fine now. It works without a problem, so it wasn't your script, Mr. President, but a change in the way our server was being managed causing a bit of confusion. Problem solved!

Offline Bryantdl7

  • Jr. Member
  • **
  • Posts: 86
  • Karma: -2
Re: AAFK V_3.1 : Anti-AFK system for Garry's Mod
« Reply #89 on: November 22, 2014, 07:05:23 PM »
How could I add a check for PAC3? I get lots of complaints from people using pac and getting kicked.