Garry's Mod

Garry's Mod

50 ratings
Simple AFK System
   
Award
Favorite
Favorited
Unfavorite
Content Type: Addon
Addon Type: Tool
Addon Tags: Build, Roleplay
File Size
Posted
Updated
3.814 KB
16 Mar, 2017 @ 2:19pm
25 Oct, 2018 @ 5:23pm
5 Change Notes ( view )

Subscribe to download
Simple AFK System

Description
Version: 222

A feature rich AFK system for any gamemode in Garry's Mod.

Type !afk in chat to toggle AFK mode!

Features:
- Allows you to provide a reason.
- Stops other players from interacting with you.
- Blocks the player from doing anything when there AFK.
- Informs other players that your AFK.
- Remembers your weapons.
- Remembers your active weapon.
- Remembers your ammo.
- Change AFK reason while your AFK.
- Admins can set 'AFK Locations' where the player will be teleported to.

Hooks/Functions developers:
-- All hooks are in both server and client realms. -- afkSystemPlayerEnter is called when the player becomes AFK. hook.Add("afkSystemPlayerEnter", "playerIsNowAFK", function(ply, reason) print(ply:Nick() .. " is now AFK because " .. reason) end) -- afkSystemPlayerUpdate is called when the player updates their reason. hook.Add("afkSystemPlayerUpdate", "playerUpdateReason", function(ply, reason) print(ply:Nick() .. " updated their AFK reason to " .. reason) end) -- afkSystemPlayerLeave is called when the player returns to the game. hook.Add("afkSystemPlayerLeave", "playerIsNowAFK", function(ply) print(ply:Nick() .. " has returned to the game.") end) -- All functions are in both server and client realms. -- 'PLAYER' in this case is a player object. PLAYER:isAFK() -- Is the player AFK? Returns a boolean either true or false. PLAYER:afkReason() -- Reason for AFK. Returns a string. PLAYER:afkTime() -- Time they started being AFK. Returns a timestamp integer. (`os.time()`)

Donate[viral32111.com]

GitHub Version[github.com]

Copyright 2017-2021 viral32111[github.com]
Popular Discussions View All (1)
5
17 Oct, 2021 @ 2:12pm
PINNED: Todo List
viral32111
34 Comments
@ your service 12 Feb @ 1:09am 
Would be cool if the player became a CPU bot while AFK like in Left 4 Dead 1 & 2.
RobPlayzPL 15 Nov, 2020 @ 2:56am 
the error message on the console says this:

[Simple AFK System] lua/autorun/server/sv_command.lua:144: attempt to concatenate a nil value
1. v - lua/autorun/server/sv_command.lua:144
2. unknown - lua/includes/modules/hook.lua:84
viral32111  [author] 15 Nov, 2020 @ 1:48am 
What's the error message? There should be one printed in the console.
RobPlayzPL 14 Nov, 2020 @ 4:53am 
how do i actually activate it cause when i type in !afk on chat on the top left it keeps saying "Simple AFK System" is creating an error
viral32111  [author] 15 Mar, 2020 @ 3:24am 
I'll add it to my to do list and get around to it when I can, but I don't really work on this addon much anymore. Sorry.
Can you add a function when players get AFK they kill themselves and after back to the game spawn again?
viral32111  [author] 29 Nov, 2018 @ 6:00am 
It's a table called "afkPositions" inside lua/autorun/server/sv_command.lua
Zeity 28 Nov, 2018 @ 8:28pm 
I am currently using this for my server but i am wondering how to set locations for being afk?
MysteriousGirl 25 Oct, 2018 @ 11:43pm 
Cool! Can't wait for the next update! Once those features are added I will definitely be adding this to the server. The auto afk and the hovering text especially.
viral32111  [author] 25 Oct, 2018 @ 5:27pm 
Update 222

Big overhaul, basically rewrote the entire addon and heavily optimized it.

For a detailed changelog see the GitHub Commit: https://github.com/viral32111/simple-afk-system/commit/30ef1171443a1b0f1caf0d593f5af5cd1519c922

In the next updates i'll probably add the following:
- Automatic AFK or auto kick/spectate when the player doesn't move for an extended period of time. (Haley and Brad's/TestBot's request)
- Overhead text above AFK players.
- "I'll be AFK in..."-like system where you can specify when you'll be AFK, then it will auto-afk you after that time has elapsed. (This is a maybe though, still thinking about it.)