Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Sistema de /AFK //
- // Scripter: zp42O //
- // Versão 1.0 //
- // Visite: www.youtube.com/z3niii //
- #define FILTERSCRIPT
- #include <a_samp>
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_RED 0xFF0000FF
- new gPlayers[MAX_PLAYERS][MAX_PLAYER_NAME+1];
- new hp = 9999999;
- new Float:phealth;
- new IsPlayerAfk[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Sistema de /afk - Feito por zp42O ");
- print("--------------------------------------\n");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- IsPlayerAfk[playerid] = 0;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- IsPlayerAfk[playerid] = 0;
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- if(IsPlayerAfk[playerid] == 1)
- {
- SendClientMessage(playerid, COLOR_RED, "ERRO: Estás neste momento AFK e não podes usar o chat. Faz /voltar para falares.");
- return 0;
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/afk", cmdtext, true, 10) == 0)
- {
- new string[33];
- if (IsPlayerAfk[playerid] == 0) {
- GetPlayerName(playerid,gPlayers[playerid],MAX_PLAYER_NAME);
- GetPlayerHealth(playerid,phealth);
- SetPlayerHealth(playerid,hp);
- TogglePlayerControllable(playerid, 0);
- format(string,sizeof(string),".:: [%s] está /AFK! ::.",gPlayers[playerid]);
- SendClientMessageToAll(COLOR_RED,string);
- IsPlayerAfk[playerid] = 1;
- return true;
- }
- if (IsPlayerAfk[playerid] == 1) {
- SendClientMessage(playerid, COLOR_RED, "ERRO: Novamente? Mas tu já estás /AFK!");
- }
- return true;
- }
- if (strcmp("/voltar", cmdtext, true, 10) == 0)
- {
- new string[33];
- if (IsPlayerAfk[playerid] == 1) {
- TogglePlayerControllable(playerid, 1);
- SetPlayerHealth(playerid,phealth);
- format(string,sizeof(string),".:: [%s] voltou! ::.",gPlayers[playerid]);
- SendClientMessageToAll(COLOR_YELLOW,string);
- IsPlayerAfk[playerid] = 0;
- return true;
- }
- if (IsPlayerAfk[playerid] == 0) {
- SendClientMessage(playerid, COLOR_RED, "ERRO: Tu não estás /AFK para usares este comando");
- }
- return true;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment