Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- SISTEMA AFK
- BY CAIO_CARTAXO
- RETIRE OS CREDITOS E PERCA SEU SERVIDOR ;***
- VISITE O BRASIL VIRTUAL LIFECITY! IP: 189.1.168.246:7805
- FORUM: WWW.BVLC.FORUMEIROS.COM
- */
- //Includes
- #include <a_caio>
- #include <a_samp>
- //Defines
- #define COR_VERMELHA 0xFF000096
- #define COR_VERDE 0x00FF0096
- #define COR_ROXO 0xC2A2DAAA
- //Forwards
- forward Chute(playerid);
- forward Segundo();
- //News
- new PlayerAfk[MAX_PLAYERS];
- new Tempo[MAX_PLAYERS];
- new sendername[MAX_PLAYER_NAME];
- new string[128];
- new cmd[128];
- new SegundoAfk[MAX_PLAYERS];
- new MinutoAfk[MAX_PLAYERS];
- new ContarSegundo;
- //Publics
- public OnPlayerConnect(playerid)
- {
- PlayerAfk[playerid] = 0;
- SegundoAfk[playerid] = 0;
- MinutoAfk[playerid] = 0;
- return 1;
- }
- public OnPlayerDisconnect(playerid)
- {
- KillTimer(Tempo[playerid]);
- SegundoAfk[playerid] = 0;
- MinutoAfk[playerid] = 0;
- return 1;
- }
- public OnFilterScriptInit()
- {
- print("Sistema AFK carregado!");
- print(" By Caio_Cartaxo");
- ContarSegundo = SetTimer("Segundo", 1000, false);
- return 1;
- }
- public OnFilterScriptExit()
- {
- KillTimer(ContarSegundo);
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- KillTimer(Tempo[i]);
- }
- }
- return 1;
- }
- public Segundo()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(MinutoAfk[i] == 60)
- {
- SegundoAfk[i] = 1;
- }
- else if(SegundoAfk[i] > 0)
- {
- SegundoAfk[i] ++;
- }
- }
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(strcmp(cmd, "/afk", true) == 0)
- {
- if(PlayerAfk[playerid] == 0)
- {
- PlayerAfk[playerid] = 1;
- LimparChat(playerid, 10);
- SetPlayerVirtualWorld(playerid, 1);
- TogglePlayerControllable(playerid, false);
- GetPlayerName(playerid, sendername, sizeof(sendername));
- Tempo[playerid] = SetTimerEx("Chute", 600000, false, "i", playerid);
- GameTextForPlayer(playerid, "~r~voce esta ausente ~w~~n~Use /online para voltar", 10000, 3);
- format(string, sizeof(string), "* %s Esta Away From Keyboard! (/afk) [By Caio_Cartaxo]", sendername);
- SendClientMessageToAll(COR_ROXO, string);
- printf("%s", string);
- SegundoAfk[playerid] = 1;
- MinutoAfk[playerid] = 0;
- }
- else
- {
- SendClientMessage(playerid, COR_VERMELHA, "Você já está AFK!");
- }
- return 1;
- }
- if(strcmp(cmd, "/online", true) == 0)
- {
- if(PlayerAfk[playerid] == 1)
- {
- PlayerAfk[playerid] = 0;
- LimparChat(playerid, 10);
- SetPlayerVirtualWorld(playerid, 0);
- TogglePlayerControllable(playerid, true);
- GetPlayerName(playerid, sendername, sizeof(sendername));
- GameTextForPlayer(playerid, "~g~Voce voltou a jogar", 3000, 3);
- format(string, sizeof(string), "* %s Voltou a jogar! (/online) [By Caio_Cartaxo]", sendername);
- SendClientMessageToAll(COR_VERDE, string);
- KillTimer(Tempo[playerid]);
- printf("%s", string);
- SegundoAfk[playerid] = 0;
- MinutoAfk[playerid] = 0;
- }
- else
- {
- SendClientMessage(playerid, COR_VERMELHA, "Você não está AFK!");
- }
- return 1;
- }
- if (strcmp(cmdtext, "/afks", true) == 0)
- {
- if(IsPlayerConnected(playerid))
- {
- SendClientMessage(playerid, COR_ROXO, "Lista de Jogadores AFK:");
- SendClientMessage(playerid, COR_VERDE, " Sistema By Caio_Cartaxo");
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(PlayerAfk[i] > 0)
- {
- GetPlayerName(i, sendername, sizeof(sendername));
- if(PlayerAfk[i] == 1)
- {
- format(string, 256, "Jogador: %s [Minutos: %d | Segundos: %d]", sendername, MinutoAfk[playerid], SegundoAfk[playerid]);
- SendClientMessage(playerid, COR_VERMELHA, string);
- }
- }
- }
- }
- }
- return 1;
- }
- return 1;
- }
- public Chute(playerid)
- {
- if(PlayerAfk[playerid] == 1)
- {
- GetPlayerName(playerid, sendername, sizeof(sendername));
- format(string, sizeof(string), "* %s Foi chutado do servidor por ficar AFK por 10 minutos! [By Caio_Cartaxo]", sendername);
- SendClientMessageToAll(COR_VERDE, string);
- printf("%s", string);
- Kick(playerid);
- }
- else { print("Este player nao esta AFK imbecil -.-"); }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment