Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- [FilterScrit]WSBan - Sistema de Banimento
- Criado por: WeenSoares.
- Ninguém está autorizado a fazer postagens deste
- [FilterScript] em outro site, a não ser com minha autoriazação !
- Todos os comandos foram feitos em ZCMD & SSCANF.
- Tamanho: 15KB
- Data/Hora da criação: 05/01/2012 - 13:12:42
- Contato: weensoares@live.com
- */
- #include <a_samp>
- #include <SII>
- #include <zcmd>
- #include <sscanf2>
- //==============================/*FORWARDS*/==============================//
- forward Banido(playerid);
- forward CheckBan(playerid);
- //==============================/*CORES*/==============================//
- #define COR_LARANJA 0xFF7100FF
- #define COR_BRANCO 0xFFFFFFAA
- #define COR_VERDEFORTE 0x33AA33AA
- #define COR_AZUL 0x33AAFFFF
- #define COR_AZULCLARO 0x00FFFFAA
- #define COR_VERMELHO 0xFF0000FF
- #define COR_AZUL 0x33AAFFFF
- //==============================/*DEFINIÇÃO DE DIALOG*/==============================//
- #define DIALOG_BANIDO 555
- //==============================/*NEWS*/==============================//
- new file[100];
- new TimerBan[MAX_PLAYERS];
- new playername[MAX_PLAYER_NAME];
- new Motivo[64];
- new Ip[24];
- new DiaBan;
- //==============================/*FILTERSCRIPTINIT*/==============================//
- public OnFilterScriptInit()
- {
- print("******************************************************");
- print("* [FilterScrit]WSBan - Sistema de Banimento *\n");
- print("* Carregando... *\n\n");
- print("* Carregado 100%. *");
- print("******************************************************");
- return 1;
- }
- //==============================/*CALLBACKS*/==============================//
- public OnPlayerConnect(playerid)
- {
- CheckBan(playerid);
- new string[128], Adm[21], MotivoBan[100], Hora, Minuto, Segundo, HoraBan, MinutoBan, SegundoBan, Dia, Mes, Ano, MesBan, AnoBan;
- GetPlayerName(playerid, playername, sizeof(playername));
- GetPlayerIp(playerid, Ip, sizeof(Ip));
- format(file, sizeof(file), "ContasBanidas/%s.ini", playername);
- if(fexist(file))
- {
- INI_Open(file);
- INI_ReadString(Adm, "Admin", 24);
- INI_ReadString(MotivoBan, "MotivoBan", 100);
- Dia = INI_ReadInt("Dia");
- Mes = INI_ReadInt("Mes");
- Ano = INI_ReadInt("Ano");
- DiaBan = INI_ReadInt("DiaBan");
- MesBan = INI_ReadInt("MesBan");
- AnoBan = INI_ReadInt("AnoBan");
- Hora = INI_ReadInt("Hora");
- Minuto = INI_ReadInt("Minuto");
- Segundo = INI_ReadInt("Segundo");
- HoraBan = INI_ReadInt("HoraBan");
- MinutoBan = INI_ReadInt("MinutoBan");
- SegundoBan = INI_ReadInt("SegundoBan");
- SendClientMessage(playerid, COR_BRANCO, "----------------------------------------------------------------------------------------------------------------------");
- SendClientMessage(playerid, COR_LARANJA, " [INFO] Seu nick está banido. ");
- format(string, sizeof(string), "[WSBan]: Admin: %s | Data: %d/%d/%d | Hora: %d:%d:%d | Motivo: %s ", Adm, Dia, Mes, Ano, Hora, Minuto, Segundo, MotivoBan);
- SendClientMessage(playerid, COR_LARANJA, string);
- format(string, sizeof(string), "[WSBan]: Vencimento Data: %d/%d/%d | Hora: %d:%d:%d", DiaBan, MesBan, AnoBan, HoraBan, MinutoBan, SegundoBan);
- SendClientMessage(playerid, COR_LARANJA, string);
- SendClientMessage(playerid, COR_BRANCO, "----------------------------------------------------------------------------------------------------------------------");
- INI_Close();
- TimerBan[playerid] = 5;
- SetTimerEx("Banido", 1000, true, "i", playerid);
- return 1;
- }
- format(file, sizeof(file), "IPsBanidos/%s.ini", Ip);
- if(fexist(file))
- {
- INI_Open(file);
- INI_ReadString(Adm, "Admin", 24);
- INI_ReadString(MotivoBan, "MotivoBan", 100);
- Dia = INI_ReadInt("Dia");
- Mes = INI_ReadInt("Mes");
- Ano = INI_ReadInt("Ano");
- DiaBan = INI_ReadInt("DiaBan");
- MesBan = INI_ReadInt("MesBan");
- AnoBan = INI_ReadInt("AnoBan");
- Hora = INI_ReadInt("Hora");
- Minuto = INI_ReadInt("Minuto");
- Segundo = INI_ReadInt("Segundo");
- HoraBan = INI_ReadInt("HoraBan");
- MinutoBan = INI_ReadInt("MinutoBan");
- SegundoBan = INI_ReadInt("SegundoBan");
- SendClientMessage(playerid, COR_BRANCO, "----------------------------------------------------------------------------------------------------------------------");
- SendClientMessage(playerid, COR_LARANJA, " [INFO] Seu IP está banido. ");
- format(string, sizeof(string), "[WSBan]: Admin: %s | Data: %d/%d/%d | Hora: %d:%d:%d | Motivo: %s ", Adm, Dia, Mes, Ano, Hora, Minuto, Segundo, MotivoBan);
- SendClientMessage(playerid, COR_LARANJA, string);
- format(string, sizeof(string), "[WSBan]: Vencimento Data: %d/%d/%d | Hora: %d:%d:%d", DiaBan, MesBan, AnoBan, HoraBan, MinutoBan, SegundoBan);
- SendClientMessage(playerid, COR_LARANJA, string);
- SendClientMessage(playerid, COR_BRANCO, "----------------------------------------------------------------------------------------------------------------------");
- INI_Close();
- TimerBan[playerid] = 5;
- SetTimerEx("Banido", 1000, true, "i", playerid);
- return 1;
- }
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- new string[128];
- if(TimerBan[playerid] >= 1)
- {
- format(file, sizeof(file), "ContasBanidas/%s.ini", playername);
- if(INI_Open(file))
- {
- format(string, sizeof(string), "[WSBan]: Você está banido e será kickado em %d segundo(s)", TimerBan[playerid]);
- ShowPlayerDialog(playerid, DIALOG_BANIDO, DIALOG_STYLE_MSGBOX, "## NICK BANIDO ##", string, "Ok", "");
- return 1;
- }
- format(file, sizeof(file), "IPsBanidos/%s.ini", Ip);
- if(INI_Open(file))
- {
- format(string, sizeof(string), "[WSBan]: Você está banido e será kickado em %d segundo(s)", TimerBan[playerid]);
- ShowPlayerDialog(playerid, DIALOG_BANIDO, DIALOG_STYLE_MSGBOX, "## NICK BANIDO ##", string, "Ok", "");
- return 1;
- }
- }
- return 1;
- }
- //================= /*COMANDOS*/ ==========================//
- CMD:ban(playerid, params[])
- {
- new string[128], Dia, Mes, Ano, Hora, Minuto, Segundo, MesBan, AnoBan,
- giveplayerid, giveplayername[MAX_PLAYER_NAME];
- if(sscanf(params, "uds[128]", giveplayerid, DiaBan, Motivo))
- {
- SendClientMessage(playerid, 0x33AA33AA, "Uso correto: /ban [id] [dias] [motivo]");
- }
- else
- {
- getdate(Ano, Mes, Dia);
- gettime(Hora, Minuto, Segundo);
- GetPlayerName(playerid, playername, sizeof(playername));
- GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
- GetPlayerIp(giveplayerid, Ip, sizeof(Ip));
- if(IsPlayerConnected(playerid))
- {
- if(IsPlayerAdmin(playerid))
- {
- if(IsPlayerConnected(giveplayerid))
- {
- if(DiaBan > 30)
- {
- SendClientMessage(playerid, COR_AZULCLARO, "[WSBan]: Você só pode banir este player no máximo 30 dias!");
- return 1;
- }
- format(string, sizeof(string), "[WSBan]: O Administrador %s baniu %s por %i dias, [Motivo: %s]", playername, giveplayername, DiaBan, Motivo);
- SendClientMessageToAll(COR_VERMELHO, string);
- format(string, sizeof(string), "%d/%d/%d", Dia, Mes, Ano);
- format(file, sizeof(file), "ContasBanidas/%s.ini", giveplayername);
- if(INI_Open(file))
- {
- INI_WriteString("Admin", playername);
- INI_WriteInt("Dia", Dia);
- INI_WriteInt("Mes", Mes);
- INI_WriteInt("Ano", Ano);
- INI_WriteInt("Hora", Hora);
- INI_WriteInt("Minuto", Minuto);
- INI_WriteInt("Segundo", Segundo);
- INI_WriteInt("DiaBan", Dia);
- INI_WriteInt("MesBan", Mes);
- INI_WriteInt("AnoBan", Ano);
- INI_WriteInt("HoraBan", Hora);
- INI_WriteInt("MinutoBan", Minuto);
- INI_WriteInt("SegundoBan", Segundo);
- INI_WriteString("MotivoBan", Motivo);
- INI_WriteString("IP", Ip);
- Dia += DiaBan;
- INI_WriteInt("DiaBan", Dia);
- while(Dia > 31)
- {
- Dia -= 31;
- Mes++;
- INI_WriteInt("DiaBan", Dia);
- INI_WriteInt("MesBan", Mes);
- }
- while(Mes > 12)
- {
- Mes -= 12;
- Ano++;
- INI_WriteInt("MesBan", Mes);
- INI_WriteInt("AnoBan", Ano);
- }
- DiaBan = INI_ReadInt("DiaBan");
- MesBan = INI_ReadInt("MesBan");
- AnoBan = INI_ReadInt("AnoBan");
- INI_Save();
- INI_Close();
- }
- format(file, sizeof(file), "IPsBanidos/%s.ini", Ip);
- if(INI_Open(file))
- {
- INI_WriteString("Admin", playername);
- INI_WriteInt("Dia", Dia);
- INI_WriteInt("Mes", Mes);
- INI_WriteInt("Ano", Ano);
- INI_WriteInt("Hora", Hora);
- INI_WriteInt("Minuto", Minuto);
- INI_WriteInt("Segundo", Segundo);
- INI_WriteInt("DiaBan", DiaBan);
- INI_WriteInt("MesBan", MesBan);
- INI_WriteInt("AnoBan", AnoBan);
- INI_WriteInt("HoraBan", Hora);
- INI_WriteInt("MinutoBan", Minuto);
- INI_WriteInt("SegundoBan", Segundo);
- INI_WriteString("MotivoBan", Motivo);
- INI_WriteString("IP", Ip);
- INI_Save();
- INI_Close();
- }
- Kick(giveplayerid);
- }
- else
- {
- format(string, sizeof(string), "[WSBan]: O ID %d não está online.", giveplayerid);
- SendClientMessage(playerid, COR_AZULCLARO, string);
- }
- }
- else
- {
- SendClientMessage(playerid, COR_AZULCLARO, "[WSBan]: Você não tem permissão para usar este comando!");
- }
- }
- else
- {
- SendClientMessage(playerid, COR_AZULCLARO, "[WSBan]: Você tem que está logado para usar este comando!");
- }
- }
- return 1;
- }
- CMD:desbanirconta(playerid, params[])
- {
- new nomedobanido[MAX_PLAYER_NAME], string[100];
- if(sscanf(params, "s[128]", nomedobanido))
- {
- SendClientMessage(playerid, 0x33AA33AA, "Uso correto: /desbanirconta [nome do banido]");
- }
- else
- {
- if(IsPlayerConnected(playerid))
- {
- if(IsPlayerAdmin(playerid))
- {
- format(file, sizeof(file), "ContasBanidas/%s.ini", nomedobanido);
- if(fexist(file))
- {
- INI_Open(file);
- INI_ReadString(Ip, "IP", 24);
- format(string, sizeof(string), "AdmCMD: Você desbaniu a conta: %s", nomedobanido);
- SendClientMessage(playerid, COR_AZUL, string);
- format(file, sizeof(file), "IPsBanidos/%s.ini", Ip);
- INI_Remove(file);
- format(file, sizeof(file), "ContasBanidas/%s.ini", nomedobanido);
- INI_Remove(file);
- INI_Close();
- }
- else
- {
- SendClientMessage(playerid, COR_VERMELHO, "[WSBan]: Essa conta não existe ou não esta banida!");
- }
- }
- else
- {
- SendClientMessage(playerid, COR_AZULCLARO, "[WSBan]: Você não tem permissão para usar este comando!");
- }
- }
- else
- {
- SendClientMessage(playerid, COR_AZULCLARO, "[WSBan]: Você tem que está logado para usar este comando!");
- }
- }
- return 1;
- }
- //================= /*TEMPO PARA SER DESCONECTADO*/ ==========================//
- public Banido(playerid)
- {
- switch(TimerBan[playerid])
- {
- case 5:
- {
- GameTextForPlayer(playerid, "~y~ 5", 1000, 3);
- }
- case 4:
- {
- GameTextForPlayer(playerid, "~y~ 4", 1000, 3);
- }
- case 3:
- {
- GameTextForPlayer(playerid, "~y~ 3", 1000, 3);
- }
- case 2:
- {
- GameTextForPlayer(playerid, "~y~ 2", 1000, 3);
- }
- case 1:
- {
- GameTextForPlayer(playerid, "~y~ 1", 1000, 3);
- }
- case 0:
- {
- GameTextForPlayer(playerid, "~r~ Kickado", 1000, 3);
- Kick(playerid);
- }
- }
- TimerBan[playerid] --;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_BANIDO)
- {
- if(response)
- {
- new string[128];
- if(TimerBan[playerid] >= 1)
- {
- format(file, sizeof(file), "ContasBanidas/%s.ini", playername);
- if(INI_Open(file))
- {
- format(string, sizeof(string), "[WSBan]: Você está banido e será kickado em %d segundo(s)", TimerBan[playerid]);
- ShowPlayerDialog(playerid, DIALOG_BANIDO, DIALOG_STYLE_MSGBOX, "## NICK BANIDO ##", string, "Ok", "");
- return 1;
- }
- format(file, sizeof(file), "IPsBanidos/%s.ini", Ip);
- if(INI_Open(file))
- {
- format(string, sizeof(string), "[WSBan]: Você está banido e será kickado em %d segundo(s)", TimerBan[playerid]);
- ShowPlayerDialog(playerid, DIALOG_BANIDO, DIALOG_STYLE_MSGBOX, "## IP BANIDO ##", string, "Ok", "");
- return 1;
- }
- }
- }
- }
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- if(TimerBan[playerid] >= 1)
- {
- ForceClassSelection(playerid);
- return 1;
- }
- return 1;
- }
- public CheckBan(playerid)
- {
- GetPlayerIp(playerid, Ip, sizeof(Ip));
- GetPlayerName(playerid, playername, sizeof(playername));
- new ano[2], mes[2], dia[2], hora[2], minuto[2], segundo[2];
- gettime(hora[0], minuto[0], segundo[0]);
- getdate(ano[0], mes[0], dia[0]);
- format(file, sizeof(file), "ContasBanidas/%s.ini", playername);
- if(fexist(file))
- {
- INI_Open(file);
- dia[1] = INI_ReadInt("DiaBan");
- mes[1] = INI_ReadInt("MesBan");
- ano[1] = INI_ReadInt("AnoBan");
- INI_Close();
- }
- else
- {
- format(file, sizeof(file), "IPsBanidos/%s.ini", Ip);
- INI_Open(file);
- dia[1] = INI_ReadInt("DiaBan");
- mes[1] = INI_ReadInt("MesBan");
- ano[1] = INI_ReadInt("AnoBan");
- INI_Close();
- }
- format(file, sizeof(file), "ContasBanidas/%s.ini", playername);
- if(fexist(file))
- {
- INI_Open(file);
- hora[1] = INI_ReadInt("HoraBan");
- minuto[1] = INI_ReadInt("MinutoBan");
- segundo[1] = INI_ReadInt("SegundoBan");
- INI_Close();
- }
- else
- {
- format(file, sizeof(file), "IPsBanidos/%s.ini", Ip);
- INI_Open(file);
- hora[1] = INI_ReadInt("HoraBan");
- minuto[1] = INI_ReadInt("MinutoBan");
- segundo[1] = INI_ReadInt("SegundoBan");
- INI_Close();
- }
- if(dia[0] >= dia[1] && mes[0] >= mes[1] && ano[0] >= ano[1] &&
- hora[0] >= hora[1] && minuto[0] >= minuto[1] && segundo[0] >= segundo[1])
- {
- GetPlayerName(playerid, playername, sizeof(playername));
- format(file, sizeof(file), "ContasBanidas/%s.ini", playername);
- if(fexist(file))
- {
- INI_Remove(file);
- INI_Close();
- }
- GetPlayerIp(playerid, Ip, sizeof(Ip));
- format(file, sizeof(file), "IPsBanidos/%s.ini", Ip);
- if(fexist(file))
- {
- INI_Remove(file);
- INI_Close();
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement