Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include a_samp
- #include zcmd
- #include sscanf2
- #if defined MAX_PLAYERS
- #undef MAX_PLAYERS
- #define MAX_PLAYERS 20
- #else
- #define MAX_PLAYERS 20
- #endif
- #define Kick(%0) SetTimerEx("Kicka", 100, false, "i", %0)
- #define Ban(%0) SetTimerEx("Bana", 100, false, "i", %0)
- #define BLACK_LIST_TIPO 8500
- #define DIALOG_BLACK_LIST_INSERIR_DATA_USUARIOS 8501
- #define DIALOG_BLACK_LIST_INSERIR_DATA_IPS 8502
- #define SPLITTER /
- new MonthTimes[12][4] =
- {
- { 31, 31, 2678400, 2678400 },
- { 28, 29, 2419200, 2505600 },
- { 31, 31, 2678400, 2678400 },
- { 30, 30, 2592000, 2592000 },
- { 31, 31, 2678400, 2678400 },
- { 30, 30, 2592000, 2592000 },
- { 31, 31, 2678400, 2678400 },
- { 31, 31, 2678400, 2678400 },
- { 30, 30, 2592000, 2592000 },
- { 31, 31, 2678400, 2678400 },
- { 30, 30, 2592000, 2592000 },
- { 31, 31, 2678400, 2678400 }
- };
- new DB:cBan;
- new Query[1024];
- public OnFilterScriptInit() {
- print("\n--------------------------------------");
- print(" cBan carregado com sucesso!");
- print("--------------------------------------\n");
- cBan = db_open("cBan.db");
- db_free_result(db_query(cBan, "CREATE TABLE IF NOT EXISTS usuarios_banidos (id INTEGER PRIMARY KEY, nome TEXT, admin TEXT, motivo TEXT, tempo NUMERIC, data_ocorrido NUMERIC)"));
- db_free_result(db_query(cBan, "CREATE TABLE IF NOT EXISTS ips_banidos (id INTEGER PRIMARY KEY, ip TEXT, admin TEXT, motivo TEXT, tempo NUMERIC, data_ocorrido NUMERIC)"));
- return 1;
- }
- public OnFilterScriptExit() {
- db_close(cBan);
- return 1;
- }
- public OnPlayerConnect(playerid) {
- new meuNome[MAX_PLAYER_NAME], DBResult:Consulta, meuIP[16];
- GetPlayerName(playerid, meuNome, MAX_PLAYER_NAME);
- GetPlayerIp(playerid, meuIP, 16);
- format (Query, 1024, "SELECT * FROM usuarios_banidos WHERE nome = '%s'", meuNome);
- Consulta = db_query(cBan, Query);
- if ( db_num_rows(Consulta) > 0 ) {
- new Admin[MAX_PLAYER_NAME], Motivo[64], Tempo;
- db_get_field_assoc(Consulta, "admin", Admin, MAX_PLAYER_NAME);
- db_get_field_assoc(Consulta, "motivo", Motivo, 64);
- db_get_field_assoc(Consulta, "tempo", Query, 1024);
- Tempo = strval(Query);
- if ( Tempo != -1 ) {
- if ( gettime() >= Tempo ) {
- format (Query, 1024, "DELETE FROM usuarios_banidos WHERE nome = '%s'", meuNome);
- db_free_result(db_query(cBan, Query));
- SendClientMessage(playerid, 0xD40000FF, "Sua conta foi desbanida! Não cometa os mesmos erros!");
- }
- else {
- format (Query, 1024, "{FFFFFF}Sua conta esta banida!\n{FF0000}Informações de banimento:\n{FFFFFF}Nome da conta: {FF0000}%s\n{FFFFFF}Administrador responsável: {FF0000}%s\n{FFFFFF}Motivo do banimento:{FF0000}%s\n{FFFFFF}Data de desbanimento: {FF0000}%s", meuNome, Admin, Motivo, timestampToDate(Tempo) );
- ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_MSGBOX, "{FF0000}Você esta banido!", Query, "Fechar", #);
- Kick(playerid);
- }
- }
- else {
- format (Query, 1024, "{FFFFFF}Sua conta esta banida!\n{FF0000}Informações de banimento:\n{FFFFFF}Nome da conta: {FF0000}%s\n{FFFFFF}Administrador responsável: {FF0000}%s\n{FFFFFF}Motivo do banimento:{FF0000}%s\n{FFFFFF}Data de desbanimento: {FF0000}Nunca", meuNome, Admin, Motivo );
- ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_MSGBOX, "{FF0000}Você esta banido!", Query, "Fechar", #);
- Kick(playerid);
- }
- }
- db_free_result(Consulta);
- format (Query, 1024, "SELECT * FROM ips_banidos WHERE ip = '%s'", meuIP);
- Consulta = db_query(cBan, Query);
- if ( db_num_rows(Consulta) > 0 ) {
- new Admin[MAX_PLAYER_NAME], Motivo[64], Tempo;
- db_get_field_assoc(Consulta, "admin", Admin, MAX_PLAYER_NAME);
- db_get_field_assoc(Consulta, "motivo", Motivo, 64);
- db_get_field_assoc(Consulta, "tempo", Query, 1024);
- Tempo = strval(Query);
- if ( Tempo != -1 ) {
- if ( gettime() >= Tempo ) {
- format (Query, 1024, "DELETE FROM ips_banidos WHERE ip = '%s'", meuIP);
- db_free_result(db_query(cBan, Query));
- SendClientMessage(playerid, 0xD40000FF, "Seu IP foi desbanido! Não cometa os mesmos erros!");
- }
- else {
- format (Query, 1024, "{FFFFFF}Seu IP esta banido!\n{FF0000}Informações de banimento:\n{FFFFFF}IP: {FF0000}%s\n{FFFFFF}Administrador responsável: {FF0000}%s\n{FFFFFF}Motivo do banimento:{FF0000}%s\n{FFFFFF}Data de desbanimento: {FF0000}%s", meuIP, Admin, Motivo, timestampToDate(Tempo) );
- ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_MSGBOX, "{FF0000}Você esta banido!", Query, "Fechar", #);
- Kick(playerid);
- }
- }
- else {
- format (Query, 1024, "{FFFFFF}Seu IP esta banido!\n{FF0000}Informações de banimento:\n{FFFFFF}IP: {FF0000}%s\n{FFFFFF}Administrador responsável: {FF0000}%s\n{FFFFFF}Motivo do banimento:{FF0000}%s\n{FFFFFF}Data de desbanimento: {FF0000}Nunca", meuIP, Admin, Motivo );
- ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_MSGBOX, "{FF0000}Você esta banido!", Query, "Fechar", #);
- Kick(playerid);
- }
- }
- db_free_result(Consulta);
- return 1;
- }
- public OnPlayerSpawn(playerid) {
- SendClientMessage(playerid, 0x00B655FF, "Este servidor utiliza o sistema cBan, desenvolvido por CasTiel!");
- SendClientMessage(playerid, 0x00B655FF, "Você pode ver todos os comandos disponíveis do sistema utilizando /ajudaban!");
- SendClientMessage(playerid, 0x00B655FF, "Consulte a lista de banidos usando /blacklist!");
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
- switch (dialogid) {
- case BLACK_LIST_TIPO: {
- if ( response ) {
- SendClientMessage(playerid, 0xFF0000FF, "Você optou por ver a lista de usuários banidos!");
- ShowPlayerDialog(playerid, DIALOG_BLACK_LIST_INSERIR_DATA_USUARIOS, DIALOG_STYLE_INPUT, "{FFFFFF}Black list", "{FFFFFF}Digite no campo abaixo a {FF0000}data referente aos bloqueios de usuários efetuados!\n{FF0000}OBS:{FFFFFF}Siga o padrão {FF0000}dd-mm-aaaa{FFFFFF}, exemplo (18/01/2013)!", "Ver lista", "Fechar");
- }
- else {
- SendClientMessage(playerid, 0xFF0000FF, "Você optou por ver a lista de IPs banidos!");
- ShowPlayerDialog(playerid, DIALOG_BLACK_LIST_INSERIR_DATA_IPS, DIALOG_STYLE_INPUT, "{FFFFFF}Black list", "{FFFFFF}Digite no campo abaixo a {FF0000}data referente aos bloqueios de IPs efetuados!\n{FF0000}OBS:{FFFFFF}Siga o padrão {FF0000}dd-mm-aaaa{FFFFFF}, exemplo (18/01/2013)!", "Ver lista", "Fechar");
- }
- }
- case DIALOG_BLACK_LIST_INSERIR_DATA_USUARIOS: {
- if ( response ) {
- new timestamp;
- timestamp = DateToTimestamp(inputtext);
- if ( strlen(inputtext) != 10 || strfind(inputtext, "/") == -1 || timestamp == -1 ) {
- SendClientMessage(playerid, 0xFF0000FF, "Data informada não segue os padrões estabelecidos!!");
- ShowPlayerDialog(playerid, DIALOG_BLACK_LIST_INSERIR_DATA_USUARIOS, DIALOG_STYLE_INPUT, "{FFFFFF}Black list", "{FFFFFF}Digite no campo abaixo a {FF0000}data referente aos bloqueios de usuários efetuados!\n{FF0000}OBS:{FFFFFF}Siga o padrão {FF0000}dd-mm-aaaa{FFFFFF}, exemplo (18/01/2013)!", "Ver lista", "Fechar");
- return 1;
- }
- new DBResult:Consulta;
- format (Query, 1024, "SELECT nome, admin, motivo FROM usuarios_banidos WHERE data_ocorrido BETWEEN %d AND %d", timestamp, (timestamp + 86399) );
- Consulta = db_query(cBan, Query);
- if (db_num_rows(Consulta) == 0 ) {
- format (Query, 1024, "{FFFFFF}Nenhum usuário foi banido em %s", inputtext);
- ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_MSGBOX, "{FFFFFF}Black list", Query, "Fechar", "");
- }
- else {
- new Nome[MAX_PLAYER_NAME], Admin[MAX_PLAYER_NAME], Motivo[64], str[128];
- Query[0] = EOS;
- do {
- db_get_field_assoc(Consulta, "nome", Nome, MAX_PLAYER_NAME);
- db_get_field_assoc(Consulta, "admin", Admin, MAX_PLAYER_NAME);
- db_get_field_assoc(Consulta, "motivo", Motivo, 64);
- format (str, 128, "{FF0000}Nome: {FFFFFF}%s - {FF0000}Admin responsável:{FFFFFF}%s - {FF0000}Motivo: {FFFFFF}%s\n", Nome, Admin, Motivo);
- strcat(Query, str);
- }
- while( db_next_row(Consulta) );
- format (str, 128, "{FFFFFF}Lista de usuários banidos em {FF0000}%s", inputtext);
- ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_MSGBOX, str, Query, "Fechar", #);
- }
- db_free_result(Consulta);
- }
- }
- case DIALOG_BLACK_LIST_INSERIR_DATA_IPS: {
- if ( response ) {
- new timestamp;
- timestamp = DateToTimestamp(inputtext);
- if ( strlen(inputtext) != 10 || strfind(inputtext, "/") == -1 || timestamp == -1 ) {
- SendClientMessage(playerid, 0xFF0000FF, "Data informada não segue os padrões estabelecidos!!");
- ShowPlayerDialog(playerid, DIALOG_BLACK_LIST_INSERIR_DATA_USUARIOS, DIALOG_STYLE_INPUT, "{FFFFFF}Black list", "{FFFFFF}Digite no campo abaixo a {FF0000}data referente aos bloqueios de usuários efetuados!\n{FF0000}OBS:{FFFFFF}Siga o padrão {FF0000}dd-mm-aaaa{FFFFFF}, exemplo (18/01/2013)!", "Ver lista", "Fechar");
- return 1;
- }
- new DBResult:Consulta;
- format (Query, 1024, "SELECT ip, admin, motivo FROM ips_banidos WHERE data_ocorrido BETWEEN %d AND %d", timestamp, (timestamp + 86399) );
- Consulta = db_query(cBan, Query);
- if (db_num_rows(Consulta) == 0 ) {
- format (Query, 1024, "{FFFFFF}Nenhum IP foi banido em %s", inputtext);
- ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_MSGBOX, "{FFFFFF}Black list", Query, "Fechar", "");
- }
- else {
- new IP[16], Admin[MAX_PLAYER_NAME], Motivo[64], str[128];
- Query[0] = EOS;
- do {
- db_get_field_assoc(Consulta, "ip", IP, 16);
- db_get_field_assoc(Consulta, "admin", Admin, MAX_PLAYER_NAME);
- db_get_field_assoc(Consulta, "motivo", Motivo, 64);
- format (str, 128, "{FF0000}IP: {FFFFFF}%s - {FF0000}Admin responsável:{FFFFFF}%s - {FF0000}Motivo: {FFFFFF}%s\n", IP, Admin, Motivo);
- strcat(Query, str);
- }
- while( db_next_row(Consulta) );
- format (str, 128, "{FFFFFF}Lista de IPs banidos em {FF0000}%s", inputtext);
- ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_MSGBOX, str, Query, "Fechar", #);
- }
- db_free_result(Consulta);
- }
- }
- }
- return 1;
- }
- /* Funções */
- stock IsLeapYear(year)
- {
- if(year % 4 == 0) return 1;
- else return 0;
- }
- stock DateToTimestamp(str[]) {
- new date[3]; // date[0] = day date[1] = month date[2] = year
- if(!sscanf(str,"p<"#SPLITTER">ddd",date[0],date[1],date[2]))
- {
- new total = 0, tmp = 0;
- total += date[0] * 86400;
- if(date[1] == 2 && date[0] < 29) tmp = ((date[2] - 1968) / 4 - 2);
- else tmp = ((date[2] - 1968) / 4 - 1);
- total += tmp * 31622400;
- total += (date[2] - 1970 - tmp) * 31536000;
- for(new i = 1; i < date[1]; i ++) total += MonthTimes[i][0 + IsLeapYear(date[2])] * 86400;
- return total;
- }
- else return -1;
- }
- stock banirConta(nome[], admin[], motivo[], tempo = -1 ) {
- format (Query, 1024, "INSERT INTO usuarios_banidos (nome, admin, motivo, tempo, data_ocorrido) VALUES ('%s', '%s', '%s', '%d', '%d')", nome, admin, motivo, tempo, gettime());
- db_free_result(db_query(cBan, Query));
- return 1;
- }
- stock banirIP(ip[], admin[], motivo[], tempo = -1) {
- format (Query, 1024, "INSERT INTO ips_banidos (ip, admin, motivo, tempo, data_ocorrido) VALUES ('%s', '%s', '%s', '%d', '%d')", ip, admin, motivo, tempo, gettime());
- db_free_result(db_query(cBan, Query));
- return 1;
- }
- stock desbanirConta(conta[]) {
- format (Query, 1024, "DELETE FROM usuarios_banidos WHERE nome = '%s'", conta);
- db_free_result(db_query(cBan, Query));
- return 1;
- }
- stock desbanirIP(ip[]) {
- format (Query, 1024, "DELETE FROM ips_banidos WHERE ip = '%s'", ip);
- db_free_result(db_query(cBan, Query));
- return 1;
- }
- stock timestampToDate(time) {
- new date[20], DBResult:Data, str[55];
- format (str, 55, "SELECT datetime(%d, 'unixepoch', 'localtime')" ,time);
- Data = db_query(cBan, str);
- db_get_field(Data, 0, date, 20);
- db_free_result(Data);
- return date;
- }
- /* Fim funções */
- /* Comandos */
- CMD:ban(playerid, params[]) {
- if (!IsPlayerAdmin(playerid))
- return SendClientMessage(playerid, 0xFF0000FF, "Comando restrito a administradores RCON!");
- new id_, motivo_[64];
- if (sscanf(params, "us[64]", id_, motivo_))
- return SendClientMessage(playerid, 0xFF0000FF, "Uso correto: /ban [ID/NOME] [MOTIVO]");
- if (!IsPlayerConnected(id_))
- return SendClientMessage(playerid, 0xFF0000FF, "Jogador offline!");
- new nome_[MAX_PLAYER_NAME], meuNome[MAX_PLAYER_NAME];
- GetPlayerName(id_, nome_, MAX_PLAYER_NAME);
- GetPlayerName(playerid, meuNome, MAX_PLAYER_NAME);
- new DBResult:verificarConta;
- format (Query, 1024, "SELECT * FROM usuarios_banidos WHERE nome = '%s'", nome_);
- verificarConta = db_query(cBan, Query);
- if ( db_num_rows(verificarConta) > 0 )
- return SendClientMessage(playerid, 0xFF0000FF, "Esta conta ja se encontra BANIDA!");
- db_free_result(verificarConta);
- banirConta(nome_, meuNome, motivo_);
- format (Query, 1024, "AdmCmd: %s[ID: %d] foi banido por %s[ID: %d] motivo: %s", nome_, id_, meuNome, playerid, motivo_);
- SendClientMessageToAll(0xFF6347AA, Query);
- Kick(id_);
- return 1;
- }
- CMD:bantemp(playerid, params[]) {
- if (!IsPlayerAdmin(playerid))
- return SendClientMessage(playerid, 0xFF0000FF, "Comando restrito a administradores RCON!");
- new id_, motivo_[64], dias_;
- if (sscanf(params, "uds[64]", id_, dias_, motivo_))
- return SendClientMessage(playerid, 0xFF0000FF, "Uso correto: /bantemp [ID/NOME] [DIAS] [MOTIVO]");
- if (dias_ <= 0)
- return SendClientMessage(playerid, 0xFF0000FF, "Número de dias inválido!");
- if (!IsPlayerConnected(id_))
- return SendClientMessage(playerid, 0xFF0000FF, "Jogador offline!");
- new nome_[MAX_PLAYER_NAME], meuNome[MAX_PLAYER_NAME];
- GetPlayerName(id_, nome_, MAX_PLAYER_NAME);
- GetPlayerName(playerid, meuNome, MAX_PLAYER_NAME);
- new DBResult:verificarConta;
- format (Query, 1024, "SELECT * FROM usuarios_banidos WHERE nome = '%s'", nome_);
- verificarConta = db_query(cBan, Query);
- if ( db_num_rows(verificarConta) > 0 )
- return SendClientMessage(playerid, 0xFF0000FF, "Esta conta ja se encontra BANIDA!");
- db_free_result(verificarConta);
- banirConta(nome_, meuNome, motivo_, (gettime() + (dias_ * 86400)));
- format (Query, 1024, "AdmCmd: %s[ID: %d] foi banido temporariamente (%d dia(s)) por %s[ID: %d] motivo: %s", nome_, id_, dias_, meuNome, playerid, motivo_);
- SendClientMessageToAll(0xFF6347AA, Query);
- Kick(id_);
- return 1;
- }
- CMD:banconta(playerid, params[]) {
- if (!IsPlayerAdmin(playerid))
- return SendClientMessage(playerid, 0xFF0000FF, "Comando restrito a administradores RCON!");
- new conta_[MAX_PLAYER_NAME], motivo_[64];
- if (sscanf(params, "s[24]s[64]", conta_, motivo_))
- return SendClientMessage(playerid, 0xFF0000FF, "Uso correto: /banconta [NOME DA CONTA] [MOTIVO]");
- new DBResult:verificarConta;
- format (Query, 1024, "SELECT * FROM usuarios_banidos WHERE nome = '%s'", conta_);
- verificarConta = db_query(cBan, Query);
- if ( db_num_rows(verificarConta) > 0 )
- return SendClientMessage(playerid, 0xFF0000FF, "Esta conta ja se encontra BANIDA!");
- db_free_result(verificarConta);
- new meuNome[MAX_PLAYER_NAME];
- GetPlayerName(playerid, meuNome, MAX_PLAYER_NAME);
- banirConta(conta_, meuNome, motivo_);
- format (Query, 1024, "AdmCmd: %s foi banido por %s[ID: %d] motivo: %s", conta_, meuNome, playerid, motivo_);
- SendClientMessageToAll(0xFF6347AA, Query);
- new i, NOME2_[MAX_PLAYER_NAME];
- for ( i = 0; i < MAX_PLAYERS; ++i) {
- if (IsPlayerConnected(i)) {
- GetPlayerName(i, NOME2_, MAX_PLAYER_NAME);
- if (!strcmp(conta_, NOME2_)) {
- Kick(i);
- break;
- }
- }
- }
- return 1;
- }
- CMD:bantempconta(playerid, params[]) {
- if (!IsPlayerAdmin(playerid))
- return SendClientMessage(playerid, 0xFF0000FF, "Comando restrito a administradores RCON!");
- new conta_[MAX_PLAYER_NAME], motivo_[64], dias_;
- if (sscanf(params, "s[24]ds[64]", conta_, dias_, motivo_))
- return SendClientMessage(playerid, 0xFF0000FF, "Uso correto: /bantempconta [NOME DA CONTA] [DIAS] [MOTIVO]");
- if (dias_ <= 0)
- return SendClientMessage(playerid, 0xFF0000FF, "Número de dias inválido!");
- new DBResult:verificarConta;
- format (Query, 1024, "SELECT * FROM usuarios_banidos WHERE nome = '%s'", conta_);
- verificarConta = db_query(cBan, Query);
- if ( db_num_rows(verificarConta) > 0 )
- return SendClientMessage(playerid, 0xFF0000FF, "Esta conta ja se encontra BANIDA!");
- db_free_result(verificarConta);
- new meuNome[MAX_PLAYER_NAME];
- GetPlayerName(playerid, meuNome, MAX_PLAYER_NAME);
- banirConta(conta_, meuNome, motivo_, (gettime() + (dias_ * 86400)));
- format (Query, 1024, "AdmCmd: %s foi banido temporariamente (%d dia(s)) por %s[ID: %d] motivo: %s", conta_, dias_, meuNome, playerid, motivo_);
- SendClientMessageToAll(0xFF6347AA, Query);
- new i, NOME2_[MAX_PLAYER_NAME];
- for ( i = 0; i < MAX_PLAYERS; ++i) {
- if (IsPlayerConnected(i)) {
- GetPlayerName(i, NOME2_, MAX_PLAYER_NAME);
- if (!strcmp(conta_, NOME2_)) {
- Kick(i);
- break;
- }
- }
- }
- return 1;
- }
- CMD:banip(playerid, params[]) {
- if (!IsPlayerAdmin(playerid))
- return SendClientMessage(playerid, 0xFF0000FF, "Comando restrito a administradores RCON!");
- new ip_[16], motivo_[64];
- if (sscanf(params, "s[16]s[64]", ip_, motivo_))
- return SendClientMessage(playerid, 0xFF0000FF, "Uso correto: /banip [IP] [MOTIVO]");
- new DBResult:verificarIP;
- format (Query, 1024, "SELECT * FROM ips_banidos WHERE ip = '%s'", ip_);
- verificarIP = db_query(cBan, Query);
- if ( db_num_rows(verificarIP) > 0 )
- return SendClientMessage(playerid, 0xFF0000FF, "Este IP ja se encontra BANIDO!");
- db_free_result(verificarIP);
- new meuNome[MAX_PLAYER_NAME];
- GetPlayerName(playerid, meuNome, MAX_PLAYER_NAME);
- banirIP(ip_, meuNome, motivo_);
- format (Query, 1024, "AdmCmd: O IP %s foi banido por %s[ID: %d] motivo: %s", ip_, meuNome, playerid, motivo_);
- SendClientMessageToAll(0xFF6347AA, Query);
- new i, IP2_[16];
- for ( i = 0; i < MAX_PLAYERS; ++i) {
- if (IsPlayerConnected(i)) {
- GetPlayerIp(i, IP2_, 16);
- if (!strcmp(ip_, IP2_))
- Kick(i);
- }
- }
- return 1;
- }
- CMD:baniptemp(playerid, params[]) {
- if (!IsPlayerAdmin(playerid))
- return SendClientMessage(playerid, 0xFF0000FF, "Comando restrito a administradores RCON!");
- new ip_[16], motivo_[64], dias_;
- if (sscanf(params, "s[16]ds[64]", ip_, dias_, motivo_))
- return SendClientMessage(playerid, 0xFF0000FF, "Uso correto: /banip [IP] [DIAS] [MOTIVO]");
- if (dias_ <= 0)
- return SendClientMessage(playerid, 0xFF0000FF, "Número de dias inválido!");
- new DBResult:verificarIP;
- format (Query, 1024, "SELECT * FROM ips_banidos WHERE ip = '%s'", ip_);
- verificarIP = db_query(cBan, Query);
- if ( db_num_rows(verificarIP) > 0 )
- return SendClientMessage(playerid, 0xFF0000FF, "Este IP ja se encontra BANIDO!");
- db_free_result(verificarIP);
- new meuNome[MAX_PLAYER_NAME];
- GetPlayerName(playerid, meuNome, MAX_PLAYER_NAME);
- banirIP(ip_, meuNome, motivo_, (gettime() + (dias_ * 86400)));
- format (Query, 1024, "AdmCmd: O IP %s foi banido temporariamente( %d dia(s) ) por %s[ID: %d] motivo: %s", ip_, dias_, meuNome, playerid, motivo_);
- SendClientMessageToAll(0xFF6347AA, Query);
- new i, IP2_[16];
- for ( i = 0; i < MAX_PLAYERS; ++i) {
- if (IsPlayerConnected(i)) {
- GetPlayerIp(i, IP2_, 16);
- if (!strcmp(ip_, IP2_))
- Kick(i);
- }
- }
- return 1;
- }
- CMD:desbanconta(playerid, params[]) {
- if (!IsPlayerAdmin(playerid))
- return SendClientMessage(playerid, 0xFF0000FF, "Comando restrito a administradores RCON!");
- if (isnull(params))
- return SendClientMessage(playerid, 0xFF0000FF, "Uso correto: /desbanconta [CONTA]");
- new DBResult:verificarConta;
- format (Query, 1024, "SELECT * FROM usuarios_banidos WHERE nome = '%s'", params);
- verificarConta = db_query(cBan, Query);
- if ( db_num_rows(verificarConta) > 0 ) {
- desbanirConta(params);
- format (Query, 1024, "AdmCmd: A conta %s foi desbanida com sucesso!", params);
- SendClientMessage(playerid, 0xFF6347AA, Query);
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "Nenhum usuário com este nome esta banido!");
- db_free_result(verificarConta);
- return 1;
- }
- CMD:desbanip(playerid, params[]) {
- if (!IsPlayerAdmin(playerid))
- return SendClientMessage(playerid, 0xFF0000FF, "Comando restrito a administradores RCON!");
- if (isnull(params))
- return SendClientMessage(playerid, 0xFF0000FF, "Uso correto: /desbanip [IP]");
- new DBResult:verificarIP;
- format (Query, 1024, "SELECT * FROM ips_banidos WHERE ip = '%s'", params);
- verificarIP = db_query(cBan, Query);
- if ( db_num_rows(verificarIP) > 0 ) {
- desbanirIP(params);
- format (Query, 1024, "AdmCmd: O IP %s foi desbanido com sucesso!", params);
- SendClientMessage(playerid, 0xFF6347AA, Query);
- }
- else
- SendClientMessage(playerid, 0xFF0000FF, "IP informado não esta banido!");
- db_free_result(verificarIP);
- return 1;
- }
- CMD:blacklist(playerid) {
- ShowPlayerDialog(playerid, BLACK_LIST_TIPO, DIALOG_STYLE_MSGBOX, "{FFFFFF}Black list", "{FFFFFF}Clique em {FF0000}Usuários {FFFFFF}se você deseja {FF0000}ver a lista de usuários banidos {FFFFFF}ou em {FF0000}IPs {FFFFFF}caso queira {FF0000}ver a lista de IPs bloqueados!", "Usuários", "IPs");
- return 1;
- }
- CMD:ajudaban(playerid) {
- if (!IsPlayerAdmin(playerid))
- return SendClientMessage(playerid, 0xFF0000FF, "Comando restrito a administradores RCON!");
- ShowPlayerDialog(playerid, 9999, DIALOG_STYLE_MSGBOX, "Menu de ajuda do cBan!", "\t{FF0000}Comandos disponíveis!\n{FFFFFF}/ban\n{FFFFFF}/bantemp\n{FFFFFF}/banconta\n{FFFFFF}/bantempconta\n{FFFFFF}/banip\n{FFFFFF}/baniptemp\n{FFFFFF}/desbanconta\n{FFFFFF}/desbanip\n{FFFFFF}/blacklist", "Fechar", #);
- return 1;
- }
- forward Kicka(p); public Kicka(p) {
- #undef Kick
- Kick(p);
- #define Kick(%0) SetTimerEx("Kicka", 100, false, "i", %0)
- return 1;
- }
- forward Bana(p); public Bana(p) {
- #undef Ban
- Ban(p);
- #define Ban(%0) SetTimerEx("Bana", 100, false, "i", %0)
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement