Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*______________________________________________________________________________________________________
- BRASIL PLAY START -
- Sistema Anti-AFK (Theus_Crazzy)
- _______________________________________________________________________________________________________*/
- #include < a_samp >
- #include < YSI\y_timers >
- #include < zcmd >
- // Defines
- #define serverCallback:%0(%1) forward %0(%1); public %0(%1)
- #define COLOR_SAMP 0xACCBF1FF
- // Variáveis
- new
- timerAusente[MAX_PLAYERS],
- Float:oldPlayerPos[3][MAX_PLAYERS]
- ;
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n_______________________________________________________");
- print(" [FilterScript] Anti-AFK [Carregado]");
- print("_______________________________________________________\n");
- return true;
- }
- public OnFilterScriptExit()
- {
- return true;
- }
- #else
- main()
- {
- print("\n_______________________________________________________");
- print(" [FilterScript] Anti-AFK [Carregado]");
- print("_______________________________________________________\n");
- }
- #endif
- // Funções
- stock checkAusente(playerid)
- {
- SetPVarInt(playerid, "timer_playerAFK", -1);
- if (timerAusente[playerid] != 0) SendClientMessage(playerid, COLOR_SAMP, "ANTI-AFK: Você não está mais inativo, atividade contando novamente."), timerAusente[playerid] = 0;
- }
- serverCallback:updatePlayerAFK(playerid, tempo)
- {
- if (tempo >= 100)
- {
- if (GetPVarInt(playerid, "timer_playerAFK") != -1)
- {
- timerAusente[playerid] = gettime();
- SendClientMessage(playerid, COLOR_SAMP, "ANTI-AFK: Você foi marcado como inativo, não está contando o tempo de atividade.");
- }
- }
- else
- {
- if (GetPVarInt(playerid, "timer_playerAFK") != -1)
- {
- tempo += 10;
- SetPVarInt(playerid, "timer_playerAFK", SetTimerEx("updatePlayerAFK", 60 * 1000, false, "ii", playerid, tempo));
- }
- }
- }
- ptask updateSystem[60000] (i)
- {
- new Float:atualPlayerPos[3][MAX_PLAYERS];
- GetPlayerPos(i, atualPlayerPos[0][i], atualPlayerPos[1][i], atualPlayerPos[2][i]);
- if (oldPlayerPos[0][i] == atualPlayerPos[0][i] && oldPlayerPos[1][i] == atualPlayerPos[1][i] && oldPlayerPos[2][i] == atualPlayerPos[2][i])
- {
- if (GetPVarInt(i, "timer_playerAFK") == -1)
- SetPVarInt(i, "timer_playerAFK", SetTimerEx("updatePlayerAFK", 1000, false, "ii", i, 0));
- }
- else
- {
- oldPlayerPos[0][i] = atualPlayerPos[0][i];
- oldPlayerPos[1][i] = atualPlayerPos[1][i];
- oldPlayerPos[2][i] = atualPlayerPos[2][i];
- SetPVarInt(i, "timer_playerAFK", -1);
- if (timerAusente[i] != 0) SendClientMessage(i, COLOR_SAMP, "ANTI-AFK: Você não está mais inativo, atividade contando novamente."), timerAusente[i] = 0;
- }
- return true;
- }
- public OnPlayerCommandPerformed(playerid, cmdtext[], success)
- {
- checkAusente(playerid);
- return 1;
- }
- public OnPlayerCommandReceived(playerid, cmdtext[])
- {
- checkAusente(playerid);
- return 0;
- }
- public OnPlayerText(playerid, text[])
- {
- checkAusente(playerid);
- return 0;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- checkAusente(playerid);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement