SA-MP Forums Archive
[Include] [AP] Anti-Pause System - Automatic - 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] [AP] Anti-Pause System - Automatic (/showthread.php?tid=625089)



[AP] Anti-Pause System - Automatic - oMa37 - 27.12.2016

Callbacks:

• OnPlayerPause(playerid, type);

Types:
1 - Player has tabbed out.
2 - Player is not moving.

• OnPlayerUnPause(playerid, type, time);

Types:
1 - Player has disconnected.
2 - Player still connected.

Time in seconds.


Functions:

• IsPlayerPaused(playerid);
- Returns 1 if the player is paused, 0 if is not.

• GetPauseTime(playerid);
- Returns player paused time in seconds.

• GetPauseType(playerid);
- Returns 1 if the player tabbed out, 2 if the player is not moving.

Defines:

• PAUSE_LABEL
- Enables the 3D text label on the player name.

• PAUSE_LABEL_TEXT "YourText"
- Change the 3D label text.

• PAUSE_LABEL_COLOR 0xCOLOR
- Change the 3D label color.

Example:

PHP Code:
#include <a_samp>
#define PAUSE_LABEL
#define PAUSE_LABEL_TEXT "I'M PAUSED PLAYER!"
#define PAUSE_LABEL_COLOR 0xFF0000FF
#include <AP> 
Requirements:

Streamer - Incognito

Bugs:

Nothing found yet, If you found post here.

Download:

ClickHere! - GitHub

Special Thanks:

- iLearner; Few ideas and suggestions.
- Konstantinos; Few notes and improvements on the code.


Enjoy, Hope you like it.


Re: [AP] Anti-Pause System - Automatic - iLearner - 27.12.2016

Good job OMA, I'll probably use it in my script (and tell you results).

PS: label has the seconds the player is paused for?


Re: [AP] Anti-Pause System - Automatic - oMa37 - 27.12.2016

My apologies if there are any bugs, I couldn't test it because of the current PC doesn't handle GTA SA.
But half of the system was used for my server, So I don't expect any bugs yet. though, I would appreciate anyone to test it and tell me if there are any bugs, Thanks.

Sorry again!


Re: [AP] Anti-Pause System - Automatic - SyS - 28.12.2016

good job mate


Re: [AP] Anti-Pause System - Automatic - Lordzy - 02.01.2017

You should consider updating the last update tick over OnPlayerStateChange and OnPlayerSpawn because OnPlayerUpdate sometimes fails to get called under these two callbacks as far as I've been experienced with. I also suggest you to have a boolean variable to know whether it should run for filterscript or for a gamemode than using the old method. It can save one byte but most of them usually forget adding such a define and ends up having no idea why it fails to work properly.
pawn Code:
new bool:afkInit = false;
public onfs...
    if (!afkInit)
        //code
    else
        //already initialized
        //so just hook
...

//same for exits and gm callbacks.



Re: [AP] Anti-Pause System - Automatic - Logic_ - 02.01.2017

Seriously mate, fk you, I wanted to make something like this Good job anyways