[Include] [Beginner] Paused player - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (
https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] [Beginner] Paused player (
/showthread.php?tid=622686)
[Beginner] Paused player -
Dayrion - 25.11.2016
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
- Without y_hooks
* 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:
Respuesta: [Beginner] Paused player -
BrianFaria - 26.11.2016
I like it
Re: [Beginner] Paused player -
Micko123 - 26.11.2016
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..
Re: [Beginner] Paused player -
Dayrion - 26.11.2016
Quote:
Originally Posted by Micko123
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.
Re: [Beginner] Paused player -
Hiddos - 27.11.2016
Are you sure you need to include y_hooks in the ALS version?
Re: [Beginner] Paused player -
Micko123 - 27.11.2016
Quote:
Originally Posted by Dayrion
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+