GithubHelp home page GithubHelp logo

iafk's Introduction

Library Documentation: Improved AFK Detection for SAMP

Description:

This library provides functionality for detecting AFK (Away From Keyboard) players in SA:MP/open.mp. It tracks player activity and pauses/unpauses them accordingly based on inactivity. Use define AFK_NAMETAG to add a player paused message above the players head while they are paused.

Usage:

Include the library in your Pawn script.
Implement the callbacks OnPlayerPause and OnPlayerUnpause to handle player pausing and unpausing events.
Optionally, utilize functions IsPlayerPause and TimeSincePaused to retrieve AFK status and time since pausing, respectively.

Functions:

IsPlayerPaused(playerid);
    Description: Checks if the player is currently paused.
    Parameters:
        playerid: ID of the player.
    Returns: 1 if the player is paused, 0 otherwise.

TimeSincePaused(playerid);
    Description: Retrieves the time elapsed since the player was paused.
    Parameters:
        playerid: ID of the player.
    Returns: Time elapsed (in seconds) since the player was paused.

Callbacks:

public OnPlayerPause(playerid) {
  // Your code here
}

public OnPlayerUnpause(playerid) {
  // Your code here
}

Notes:

This library is optimized for use with San Andreas Multiplayer (SA:MP) servers.
Ensure that callbacks OnPlayerPause and OnPlayerUnpause are properly implemented to handle player pausing and unpausing events.

README: Improved AFK Detection for SAMP

This library provides enhanced AFK (Away From Keyboard) detection functionality for SA:MP servers. It automatically detects inactive players and pauses them, triggering the appropriate events for handling AFK status changes. Installation:

Copy the iafk.inc file into your SA:MP server's pawno/includes directory.
Include the library in your Pawn script using #include <iafk>.

Usage:

Implement the required callback functions: OnPlayerPause and OnPlayerUnpause.
Utilize the provided functions to check AFK status and time since pausing, if needed.

Credits:

Original Credits to Miihai
Improved by realdiegopoptart for compatibility with YSI foreach.

License:

This library is provided under the MIT License. Feel free to modify and distribute it as needed.

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.