• Print

Author Topic: AFK Script help  (Read 6601 times)

0 Members and 1 Guest are viewing this topic.

Offline ArnyDaHamsta

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
AFK Script help
« on: November 07, 2016, 09:06:30 am »
Hey! So I recently got a AFK script, but it kicks me when I am owner.  How do I add it so that id won't kick admins, superadmins, developer, co-owner and owner?

Here is the code:

http://pastebin.com/dmrURA37

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: AFK Script help
« Reply #1 on: November 07, 2016, 10:13:42 am »
If inheritances are setup how I'd think they are, in the order you specified, put a check right after the for loop that checks if the person is an admin or higher (use this to help) and if they are, do nothing (return end)
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline ArnyDaHamsta

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: AFK Script help
« Reply #2 on: November 07, 2016, 10:44:30 am »
Not a clue what that means

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: AFK Script help
« Reply #3 on: November 07, 2016, 11:26:38 am »
You're going to want to check if the person is an Admin or higher
Code: Lua
  1. if ply:CheckGroup( "admin" ) then
and if they are, do nothing
Code: Lua
  1. return end

So this is what you would add:

Code: Lua
  1. hook.Add("Think", "HandleAFKPlayers", function()
  2.     for _, ply in pairs (player.GetAll()) do
  3.         if ply:CheckGroup( "admin" ) then return end
  4.     -- Rest of your code here
  5.  
« Last Edit: November 07, 2016, 02:55:41 pm by iViscosity »
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

  • Print