Giter Club home page Giter Club logo

simple-afk-system's Introduction

Simple AFK System

Version: 222

A 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:

-- 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.

simple-afk-system's People

Contributors

viral32111 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.