25.11.2016, 15:14
(
Last edited by Dayrion; 26/11/2016 at 11:44 PM.
)
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>
pawn Code:
#include <pause_hook>
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.
-------------------------------------------------------------------------------------
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>
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: