[Include] [Beginner] Paused player
#1

pause.inc
Before I start, I know full well that this include is very simple to achieve. This is why it is intended for beginners. No, this topic is not for me to collect "+ rep". I do not ask it. This include was mainly created to make me understand how the ALS hooking method works (see credits).

* There are two ways to use the include:
- With y_hooks
pawn Code:
#include <pause_ALS>
- Without y_hooks
pawn Code:
#include <pause_hook>
* Callback & function:

pawn Code:
-------------------------------------------------------------------------------------
    public OnPlayerUnPause(playerid, time);
        - When a player return in game after being AFK. Give the time, in seconds, which the player were AFK.
    public OnPlayerPause(playerid);
        - When a player back to the desktop or press ESC.
    bool:IsPlayerPaused(playerid);
        - Return if or not a player is in pause.
    -------------------------------------------------------------------------------------
* Configuration:
If you want to set custom value, you have to defined before including.
pawn Code:
#define INTERVAL_AFK_DETECT 500 // Every 500 ms, a timer check if a player AFK or not (Recommended : 800ms)
#define MAX_TIME_ALLOWED 3 // Time (in seconds) which a player is considered as afk (Recommended : 3 seconds)
#include <pause_hook> // or <pause_ALS>
* Include:
pause_hook.inc
pause_ALS.inc

* Credits:
» Konstantinos : For this major help since I start to learn MySQL and ALS.
» [HLF]Southclaw : For his major and precious help. If you are looking to understand ALS hooking method, please, read this.
» ******: for his include (y_hook).

I hope there is no bug and no English grammar mistake. If there are, sorry. x:
Reply
#2

I like it
Reply
#3

So lets say that player is being stoped by police and talking to them.. with 3 sec standing in one place he is considered afk??
Make that a few minutes m8.. Also don't make 500ms timer. Make it bigger because you don't want 50 timers 500ms for every player
It is good for beginners but still..
Reply
#4

Quote:
Originally Posted by Micko123
View Post
So lets say that player is being stoped by police and talking to them.. with 3 sec standing in one place he is considered afk??
Make that a few minutes m8.. Also don't make 500ms timer. Make it bigger because you don't want 50 timers 500ms for every player
It is good for beginners but still..
Na. If the player stands IG without doing something, he isn't considered as AFK. If the player go watch a video, for example, he is considered as AFK (yep even if he is not away from his keyboard.. xD).
There is 1 timer, not 50.
Reply
#5

Are you sure you need to include y_hooks in the ALS version?
Reply
#6

Quote:
Originally Posted by Dayrion
View Post
Na. If the player stands IG without doing something, he isn't considered as AFK. If the player go watch a video, for example, he is considered as AFK (yep even if he is not away from his keyboard.. xD).
There is 1 timer, not 50.
Yeah you are right.. I am sorry didn't red the code before i wrote that
Good job then. rep+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)