Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============[ Defines ]=======================//
- #define FILTERSCRIPT
- #if defined FILTERSCRIPT
- #define ConvertDays(%0) (gettime() + (86400 * (%0)))
- #define CorBan 0x058AFFFF
- //=============[ Includes ]======================//
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- #include <DOF2>
- //=============[ Variaveis ]=====================//
- enum Info
- {
- Banido
- }
- new Player[MAX_PLAYERS][Info];
- new D, Mes, A, H, M, S, Tempo[24], Data[24], DString[250];
- public OnFilterScriptInit()
- {
- print("¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨");
- print("¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨");
- print("¨¨Sistema de Ban feito por: DelK Carregado com Exîto.¨¨\n");
- print("¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨[ Sistema DBan/v1.0 ]¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨");
- print("¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨");
- print("¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨");
- return 1;
- }
- #endif
- public OnPlayerConnect(playerid)
- {
- new Arquivo[64];
- format(Arquivo, sizeof(Arquivo), "TempBan/%s.ini", PegarNome(playerid));
- if(DOF2_FileExists(Arquivo))
- {
- Player[playerid][Banido] = DOF2_GetInt(Arquivo,"Dias");
- if(VerifyExpiredDays(Player[playerid][Banido]))
- {
- DOF2_RemoveFile(Arquivo);
- Player[playerid][Banido] = 0;
- SendClientMessage(playerid, CorBan, "Seu ban temporário chegou ao fim.!");
- }
- else
- {
- SetTimerEx("KickBan",300, false, "i", playerid);
- format(DString, sizeof(DString), "{FFFFF0}Seu IP: {FF4040}%s{FFFFF0}\n\nSeu Nick: {FF4040}%s{FFFFF0}\n\nBanido por: {FF4040}%s{FFFFF0}\n\nMotivo do Ban: {FF4040}%s{FFFFF0}\n\nTempo Restante: {FF4040}%s.", Pegarip(playerid), PegarNome(playerid), DOF2_GetString(Arquivo, "Admin"), DOF2_GetString(Arquivo, "Motivo"), ConvertToDays(Player[playerid][Banido]));
- ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Sistema de Ban", DString, "Ok", "");
- }
- }
- new Arquivo2[64];
- format(Arquivo2, sizeof(Arquivo2), "Banidos/%s.ini", Pegarip(playerid));
- if(DOF2_FileExists(Arquivo2))
- {
- format(DString, sizeof(DString), "{FFFFF0}Seu IP: {FF4040}%s{FFFFF0}\n\nSeu Nick: {FF4040}%s{FFFFF0}\n\nBanido por: {FF4040}%s{FFFFF0}\n\nMotivo do Ban: {FF4040}%s{FFFFF0}", Pegarip(playerid), PegarNome(playerid), DOF2_GetString(Arquivo2, "Admin"), DOF2_GetString(Arquivo2, "Motivo"));
- ShowPlayerDialog(playerid, 2, DIALOG_STYLE_MSGBOX, "Sistema de Ban", DString, "Ok", "");
- SetTimerEx("KickBan",300, false, "i", playerid);
- return 1;
- }
- new Arquivo3[64];
- format(Arquivo3, sizeof(Arquivo3), "BansAgendados/%s.ini", PegarNome(playerid));
- if(DOF2_FileExists(Arquivo3))
- {
- Player[playerid][Banido] = DOF2_GetInt(Arquivo3,"Dias");
- if(VerifyExpiredDays(Player[playerid][Banido]))
- {
- DOF2_RemoveFile(Arquivo3);
- Player[playerid][Banido] = 0;
- SendClientMessage(playerid, CorBan, "Seu ban temporário chegou ao fim.!");
- }
- else
- {
- SetTimerEx("KickBan",300, false, "i", playerid);
- format(DString, sizeof(DString), "{FFFFF0}Seu Nick: {FF4040}%s{FFFFF0}\n\nBanido por: {FF4040}%s{FFFFF0}\n\nMotivo do Ban: {FF4040}%s{FFFFF0}\n\nTempo Restante: {FF4040}%s{FFFFF0}.", PegarNome(playerid), DOF2_GetString(Arquivo3, "Admin"), DOF2_GetString(Arquivo3, "Motivo"), ConvertToDays(DOF2_GetInt(Arquivo3, "Dias")));
- ShowPlayerDialog(playerid, 4, DIALOG_STYLE_MSGBOX, "Ban Agendado", DString, "Ok", "");
- }
- }
- return 1;
- }
- CMD:desban(playerid, params[])
- {
- new nick[24], Arquivo[64];
- if(sscanf(params, "s[24]", nick)) return SendClientMessage(playerid, CorBan, "Uso: /desban [nick]");
- format(Arquivo, 64, "Banidos/%s.ini", nick);//Desbanindo Ip
- format(Arquivo, 64, "Banidos/%s.ini", Pegarip(playerid));//Desbanindo Nick
- if(!DOF2_FileExists(Arquivo)) return SendClientMessage(playerid, CorBan,"Está conta não se encontra banida.");
- if(DOF2_FileExists(Arquivo))
- {
- DOF2_RemoveFile(Arquivo);
- SendClientMessage(playerid, CorBan, "Conta retirada da lista de bans com sucesso.");
- }
- return 1;
- }
- CMD:cancelarban(playerid, params[])
- {
- new nick[16], Motivo[50], Arquivo[64];
- if(sscanf(params,"s[16]s[50]", nick, Motivo)) return SendClientMessage(playerid, -1, "Use: /agendarban [nick] [motivo]");
- format(DString, sizeof(DString), "{FFFFF0}%s Cancelou o ban de {FF4040}%s{FFFFF0} | Motivo: {FF4040}%s", PegarNome(playerid), nick, Motivo);
- SendClientMessageToAll(CorBan, DString);
- format(Arquivo, sizeof(Arquivo), "BansAgendados/%s.ini", nick);
- if(!DOF2_FileExists(Arquivo)) return SendClientMessage(playerid, CorBan," Está conta não se encontra na agenda.");
- DOF2_RemoveFile(Arquivo);
- return 1;
- }
- CMD:agendarban(playerid, params[])//Faz uma agenda de ban para o player que sair do servidor, vc agenda e quando ele logar de novo será banido automaticamente.
- {
- new nick[16], Dias, Motivo[50];
- if(sscanf(params,"s[16]ds[50]", nick, Dias, Motivo)) return SendClientMessage(playerid, -1, "Use: /agendarban [nick] [dias] [motivo]");
- format(DString, sizeof(DString), "{FFFFF0}%s Agendou o ban de {FF4040}%s{FFFFF0} por: {FF4040}%d {FFFFF0}dias | Motivo: {FF4040}%s", PegarNome(playerid), nick, Dias, Motivo);
- SendClientMessageToAll(CorBan, DString);
- new Arquivo[64];
- format(Arquivo, sizeof(Arquivo), "BansAgendados/%s.ini", nick);
- DOF2_CreateFile(Arquivo);
- Dias = ConvertDays(Dias);
- DOF2_SetString(Arquivo, "Nick", nick);
- DOF2_SetString(Arquivo, "Admin", PegarNome(playerid));
- DOF2_SetString(Arquivo, "Motivo", Motivo);
- DOF2_SetInt(Arquivo, "Dias", Dias);
- DOF2_SaveFile();
- return 1;
- }
- CMD:tempban(playerid, params[])
- {
- new nick, Dias, Motivo[50];
- if(sscanf(params, "uds[50]", nick, Dias, Motivo)) return SendClientMessage(playerid, -1, "Uso: /tempban [nick ou id] [dias] [motivo]");
- if(!IsPlayerConnected(nick)) return SendClientMessage(playerid, -1, "Este id não está conectado");
- format(DString, sizeof(DString), "{FFFFF0}%s Baniu {FF4040}%s{FFFFF0} por: {FF4040}%d{FFFFF0} dias | Motivo: {FF4040}%s", PegarNome(playerid), PegarNome(nick), Dias, Motivo);
- SendClientMessageToAll(CorBan, DString);
- DTempBan(nick, playerid, Dias, Motivo);
- return 1;
- }
- CMD:banirip(playerid, params[])
- {
- new ip[16], motivo[50], Arquivo[64];
- if(sscanf(params, "s[16]s[50]", ip, motivo)) return SendClientMessage(playerid, -1, "Uso: /banirip [IP] [motivo]");
- format(DString, sizeof(DString), "{FFFFF0}%s Bloqueou a entrada do ip: {FF4040}%s{FFFFF0} | Motivo: {FF4040}%s.", PegarNome(playerid), ip, motivo);
- SendClientMessageToAll(CorBan, DString);
- format(Arquivo, 64, "Banidos/%s.ini", ip);//Banindo Ip
- DOF2_CreateFile(Arquivo);
- DOF2_SetString(Arquivo, "Admin", PegarNome(playerid));
- DOF2_SetString(Arquivo, "Motivo", motivo);
- DOF2_SaveFile();
- return 1;
- }
- CMD:ban(playerid, params[])
- {
- new id, Motivo[50];
- if(sscanf(params, "us[50]", id, Motivo)) return SendClientMessage(playerid, -1, "Uso: /ban [nick ou id] [motivo]");
- if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Este id não está conectado");
- format(DString, sizeof(DString), "{FF4040}%s{FFFFF0} Teve sua conta banida permantentemente pelo administrador: {FF4040}%s{FFFFF0} | Motivo: {FF4040}%s.", PegarNome(id), PegarNome(playerid), Motivo);
- SendClientMessageToAll(CorBan, DString);
- DBan(id, playerid, Motivo);
- return 1;
- }
- CMD:pegarip(playerid, params[])
- {
- new id;
- if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "Uso: /pegarip [nick ou id]");
- if(!IsPlayerConnected(id)) return SendClientMessage(playerid, -1, "Este id não está conectado");
- format(DString, sizeof(DString), "%s IP do player: %s", Pegarip(id), PegarNome(id));
- SendClientMessage(playerid, CorBan, DString);
- return 1;
- }
- forward DBan(playerid, admin, Motivo[]);
- public DBan(playerid, admin, Motivo[])
- {
- new Arquivo[64], Arquivo2[64];
- SetTimerEx("KickBan",300, false, "i", playerid);
- format(Arquivo2, 64, "Banidos/%s.ini", Pegarip(playerid));//Banindo Ip
- DOF2_CreateFile(Arquivo2);
- DOF2_SetString(Arquivo2, "Nick", PegarNome(playerid));
- DOF2_SetString(Arquivo2, "Admin", PegarNome(admin));
- DOF2_SetString(Arquivo2, "Motivo", Motivo);
- format(Arquivo, 64, "Banidos/%s.ini", PegarNome(playerid));//Banindo Nome
- DOF2_CreateFile(Arquivo);
- DOF2_SetString(Arquivo, "Admin", PegarNome(admin));
- DOF2_SetString(Arquivo, "Motivo", Motivo);
- DOF2_SaveFile();
- return 1;
- }
- forward DTempBan(playerid, admin, Dias, Motivo[]);
- public DTempBan(playerid, admin, Dias, Motivo[])
- {
- new Arquivo[64], DString2[250], Arquivo2[64];
- getdate(A, Mes, D);
- format(Data, 20, "%02d/%02d/%d", D, Mes, A);
- gettime(H, M, S);
- format(Tempo, 20, "%02d:%02d:%02d", H, M, S);
- Player[playerid][Banido] = ConvertDays(Dias);
- format(Arquivo, sizeof(Arquivo), "TempBan/%s.ini", Pegarip(playerid));//Banindo Ip
- DOF2_CreateFile(Arquivo);
- DOF2_SetString(Arquivo, "Nick", PegarNome(playerid));
- format(Arquivo2, 64, "TempBan/%s.ini", PegarNome(playerid));//Banindo nick
- DOF2_CreateFile(Arquivo2);
- DOF2_SetString(Arquivo2, "IP", Pegarip(playerid));
- DOF2_SetString(Arquivo2, "Admin", PegarNome(admin));
- DOF2_SetInt(Arquivo2, "Dias", Player[playerid][Banido]);
- DOF2_SetString(Arquivo2, "Motivo", Motivo);
- DOF2_SetString(Arquivo2, "Data", Data);
- DOF2_SetString(Arquivo2, "Horario", Tempo);
- DOF2_SaveFile();
- SetTimerEx("KickBan",300, false, "i", playerid);
- format(DString2, sizeof(DString2), "{FFFFF0}Seu Nick: {FF4040}%s{FFFFF0}\n\nBanido por: {FF4040}%s{FFFFF0}\n\nMotivo: {FF4040}%s{FFFFF0}\n\nHorário: {FF4040}%s{FFFFF0}\n\nData: {FF4040}%s{FFFFF0}\n\nTempo Restante: {FF4040}%s.", PegarNome(playerid), PegarNome(admin), Motivo, Tempo, Data, ConvertToDays(Player[playerid][Banido]));
- ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "Sistema de Ban", DString2, "Ok", "");
- return 1;
- }
- forward KickBan(playerid);
- public KickBan(playerid)
- {
- Kick(playerid);
- }
- stock VerifyExpiredDays(days)
- return (days) < gettime();
- stock ConvertToDays(n)
- {
- #pragma tabsize 0
- new t[5];
- t[4] = n-gettime();
- t[0] = t[4] / 3600;
- t[1] = ((t[4] / 60) - (t[0] * 60));
- t[2] = (t[4] - ((t[0] * 3600) + (t[1] * 60)));
- t[3] = (t[0]/24);
- if(t[3] > 0)
- t[0] = t[0] % 24,
- format(DString, sizeof(DString), "%ddias, %02dh %02dm e %02ds", t[3], t[0], t[1], t[2]);
- else if(t[0] > 0)
- format(DString, sizeof(DString), "%02dh %02dm e %02ds", t[0], t[1], t[2]);
- else
- format(DString, sizeof(DString), "%02dm e %02ds", t[1], t[2]);
- return DString;
- }
- stock PegarNome(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- return name;
- }
- stock Pegarip(playerid)
- {
- new ip[16];
- GetPlayerIp(playerid, ip, sizeof(ip));
- return ip;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement