https://github.com/viral32111/simple-afk-system
Simple AFK System for Garry's Mod
https://github.com/viral32111/simple-afk-system
addon afk garry-mod lua player weapons
Last synced: 22 days ago
JSON representation
Simple AFK System for Garry's Mod
- Host: GitHub
- URL: https://github.com/viral32111/simple-afk-system
- Owner: viral32111
- License: apache-2.0
- Created: 2017-01-21T16:50:07.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-01-01T10:57:36.000Z (over 3 years ago)
- Last Synced: 2025-02-14T21:27:02.286Z (3 months ago)
- Topics: addon, afk, garry-mod, lua, player, weapons
- Language: Lua
- Homepage: https://viral32111.com
- Size: 339 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple AFK System
#### Version: 222A simple addon for Garry's Mod that allows a player to toggle being AFK by typing `!afk` in chat.
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.This addon includes a few hooks and functions for developers to use, examples:
```lua
-- All hooks are in both server and client realms.
-- afkSystemPlayerEnter is called when the player becomes AFK.
hook.Add("afkSystemPlayerEnter", "playerEnteredAFK", 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", "playerLeftAFK", 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 entity.
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()`)
```This addon is also available on the [Steam Workshop here](http://steamcommunity.com/sharedfiles/filedetails/?id=884852300).
###### [Copyright 2017 - 2022 viral32111](LICENCE.md)