mysql_ban_connect(const host[], const user[], const database[], const password[]);
mysql_ban_connect("localhost", "root", "server_samp", "");
bool:mysql_ban_player_check(Find[])
//VERIFICANDO PELO NOME
GetPlayerName(playerid, Nome, 24);
if(mysql_ban_player_check(Nome) == true)
{
//Player On
}
else
{
//Player Off
}
//VERIFICANDO PELO IP
GetPlayerIp(playerid, IP, 16);
if(mysql_ban_player_check(IP) == true)
{
//Player On
}
else
{
//Player Off
}
mysql_ban_player(Player_Name[], Player_IP[], Ban_By[], Reason[], Ban_Type, Time);
mysql_ban_player("WesleyScript", "127.0.0.1", "F1N4L", "LIXO", PERMANENTE, 0);
#define PERMANENTE 0 #define MINUTOS 1 #define HORAS 2 #define DIAS 3
mysql_ban_remove(Banned[]);
bool:mysql_ban_remove_check(Banned[])
//VERIFICANDO PELO NOME
if(mysql_ban_player_check("F1N4L") == true)
{
//Coluna encontrada
}
else
{
//Coluna nгo encontrada
}
//VERIFICANDO PELO IP
if(mysql_ban_player_check("127.0.0.1") == true)
{
//Coluna encontrada
}
else
{
//Coluna nгo encontrada
}
mysql_banned_check(playerid);
public OnFilterScriptInit() // ou OnGameModeInit
{
mysql_ban_connect("localhost", "root", "server_samp", "");
return 1;
}
CMD:banname(playerid, params[])
{
new NomeBanido[24], NomeBanidoPor[24], Motivo[20], TipoBanimento, Tempo,String[128];
if(sscanf(params, "s[24]iis[20]", NomeBanido, TipoBanimento, Tempo, Motivo)) return SendClientMessage(playerid, -1, "/ban [nome] [Tipo: 0 = permanente | 1 = minutos | 2 = horas | 3 = dias] [tempo] [motivo]");
if(TipoBanimento < 0 || TipoBanimento > 3) return SendClientMessage(playerid, -1, "Tipo de banimento incorreto! Utilize: 0 = permanente | 1 = minutos | 2 = horas | 3 = dias");
GetPlayerName(playerid, NomeBanidoPor, sizeof NomeBanidoPor);
if(mysql_ban_player_check(NomeBanido) == true)
{
switch(TipoBanimento)
{
case 0: format(String, sizeof String, "Admin %s baniu Online o jogador %s. Motivo: %s. Tempo: PERMANENTE", NomeBanidoPor, NomeBanido, Motivo);
case 1: format(String, sizeof String, "Admin %s baniu Online o jogador %s. Motivo: %s. Tempo: %i Minutos", NomeBanidoPor, NomeBanido, Motivo, Tempo);
case 2: format(String, sizeof String, "Admin %s baniu Online o jogador %s. Motivo: %s. Tempo: %i Horas", NomeBanidoPor, NomeBanido, Motivo, Tempo);
case 3: format(String, sizeof String, "Admin %s baniu Online o jogador %s. Motivo: %s. Tempo: %i Dias", NomeBanidoPor, NomeBanido, Motivo, Tempo);
}
}
else
{
switch(TipoBanimento)
{
case 0: format(String, sizeof String, "Admin %s baniu Offline o jogador %s. Motivo: %s. Tempo: PERMANENTE", NomeBanidoPor, NomeBanido, Motivo);
case 1: format(String, sizeof String, "Admin %s baniu Offline o jogador %s. Motivo: %s. Tempo: %i Minutos", NomeBanidoPor, NomeBanido, Motivo, Tempo);
case 2: format(String, sizeof String, "Admin %s baniu Offline o jogador %s. Motivo: %s. Tempo: %i Horas", NomeBanidoPor, NomeBanido, Motivo, Tempo);
case 3: format(String, sizeof String, "Admin %s baniu Offline o jogador %s. Motivo: %s. Tempo: %i Dias", NomeBanidoPor, NomeBanido, Motivo, Tempo);
}
}
SendClientMessageToAll(-1, String);
mysql_ban_player(NomeBanido, "0.0.0.0", NomeBanidoPor, Motivo, TipoBanimento, Tempo);
return 1;
}
CMD:banip(playerid, params[])
{
new IpBanido[24], NomeBanidoPor[24], Motivo[20], TipoBanimento, Tempo, String[128];
if(sscanf(params, "s[16]iis[20]", IpBanido, TipoBanimento, Tempo, Motivo)) return SendClientMessage(playerid, -1, "/ban [nome] [Tipo: 0 = permanente | 1 = minutos | 2 = horas | 3 = dias] [tempo] [motivo]");
if(TipoBanimento < 0 || TipoBanimento > 3) return SendClientMessage(playerid, -1, "Tipo de banimento incorreto! Utilize: 0 = permanente | 1 = minutos | 2 = horas | 3 = dias");
GetPlayerName(playerid, NomeBanidoPor, sizeof NomeBanidoPor);
if(mysql_ban_player_check(IpBanido) == true)
{
switch(TipoBanimento)
{
case 0: format(String, sizeof String, "Admin %s baniu Online a faixa de IP %s. Motivo: %s. Tempo: PERMANENTE", NomeBanidoPor, IpBanido, Motivo);
case 1: format(String, sizeof String, "Admin %s baniu Online a faixa de IP %s. Motivo: %s. Tempo: %i Minutos", NomeBanidoPor, IpBanido, Motivo, Tempo);
case 2: format(String, sizeof String, "Admin %s baniu Online a faixa de IP %s. Motivo: %s. Tempo: %i Horas", NomeBanidoPor, IpBanido, Motivo, Tempo);
case 3: format(String, sizeof String, "Admin %s baniu Online a faixa de IP %s. Motivo: %s. Tempo: %i Dias", NomeBanidoPor, IpBanido, Motivo, Tempo);
}
}
else
{
switch(TipoBanimento)
{
case 0: format(String, sizeof String, "Admin %s baniu Offline a faixa de IP %s. Motivo: %s. Tempo: PERMANENTE", NomeBanidoPor, IpBanido, Motivo);
case 1: format(String, sizeof String, "Admin %s baniu Offline a faixa de IP %s. Motivo: %s. Tempo: %i Minutos", NomeBanidoPor, IpBanido, Motivo, Tempo);
case 2: format(String, sizeof String, "Admin %s baniu Offline a faixa de IP %s. Motivo: %s. Tempo: %i Horas", NomeBanidoPor, IpBanido, Motivo, Tempo);
case 3: format(String, sizeof String, "Admin %s baniu Offline a faixa de IP %s. Motivo: %s. Tempo: %i Dias", NomeBanidoPor, IpBanido, Motivo, Tempo);
}
}
SendClientMessageToAll(-1, String);
mysql_ban_player("N/A", IpBanido, NomeBanidoPor, Motivo, TipoBanimento, Tempo);
return 1;
}
CMD:banid(playerid, params[])
{
new Banido, IpBanido[24], NomeBanido[24], NomeBanidoPor[24], Motivo[20], TipoBanimento, Tempo, String[128];
if(sscanf(params, "uiis[20]", Banido, TipoBanimento, Tempo, Motivo)) return SendClientMessage(playerid, -1, "/ban [id/nome] [Tipo: 0 = permanente | 1 = minutos | 2 = horas | 3 = dias] [tempo] [motivo]");
if(!IsPlayerConnected(Banido)) return SendClientMessage(playerid, -1, "Jogador nгo conectado!");
if(TipoBanimento < 0 || TipoBanimento > 3) return SendClientMessage(playerid, -1, "Tipo de banimento incorreto! Utilize: 0 = permanente | 1 = minutos | 2 = horas | 3 = dias");
GetPlayerName(playerid, NomeBanidoPor, sizeof NomeBanidoPor);
GetPlayerName(Banido, NomeBanido, sizeof NomeBanido);
GetPlayerIp(Banido, IpBanido, sizeof IpBanido);
if(mysql_ban_player_check(IpBanido) == true)
{
switch(TipoBanimento)
{
case 0: format(String, sizeof String, "Admin %s baniu Online o jogador %s [IP: %s]. Motivo: %s. Tempo: PERMANENTE", NomeBanidoPor, NomeBanido, IpBanido, Motivo);
case 1: format(String, sizeof String, "Admin %s baniu Online o jogador %s [IP: %s]. Motivo: %s. Tempo: %i Minutos", NomeBanidoPor, NomeBanido, IpBanido, Motivo, Tempo);
case 2: format(String, sizeof String, "Admin %s baniu Online o jogador %s [IP: %s]. Motivo: %s. Tempo: %i Horas", NomeBanidoPor, NomeBanido, IpBanido, Motivo, Tempo);
case 3: format(String, sizeof String, "Admin %s baniu Online o jogador %s [IP: %s]. Motivo: %s. Tempo: %i Dias", NomeBanidoPor, NomeBanido, IpBanido, Motivo, Tempo);
}
SendClientMessageToAll(-1, String);
}
else SendClientMessage(playerid, -1, "Player ID informado nгo estб conectado!");
mysql_ban_player(NomeBanido, IpBanido, NomeBanidoPor, Motivo, TipoBanimento, Tempo);
return 1;
}
CMD:banremove(playerid, params[])
{
if(isnull(params)) return SendClientMessage(playerid, -1, "/banremove [name/ip]");
if(mysql_ban_remove_check(params) == true)
{
mysql_ban_remove(params);
SendClientMessage(playerid, -1, "Jogador/IP encontrado e desbanido com sucesso!");
}
else SendClientMessage(playerid, -1, "Jogador/IP nгo foi encontrado no Banco de Dados!");
return 1;
}


|
Porra!
Meus parabйns em cara, Alйm de vocк chega no ponto aonde eu tava batendo cabeзa vocк acabou me ajudando que foi na parte do CheckBan Thank ![]() |
stock ConvertTime(SEGUNDOS_)
{
new MINUTOS_, HORAS_, DIAS_, String[200];
if(SEGUNDOS_ > 59)
{
MINUTOS_ = SEGUNDOS_ / 60;
SEGUNDOS_ = SEGUNDOS_ - MINUTOS_ * 60;
}
if(MINUTOS_ > 59)
{
HORAS_ = MINUTOS_ / 60;
MINUTOS_ = MINUTOS_ - HORAS_ * 60;
}
if(HORAS_ > 23)
{
DIAS_ = HORAS_ / 24;
HORAS_ = HORAS_ - DIAS_ * 24;
}
format(String, sizeof(String), "%02d Dias e %02d Horas e %02d Minutos e %02d Segundos", DIAS_, HORAS_, MINUTOS_, SEGUNDOS_);
if(DIAS_ < 1) format(String, sizeof(String), "%02d Horas e %02d Minutos e %02d Segundos", HORAS_, MINUTOS_, SEGUNDOS_);
if(DIAS_ < 1 && HORAS_ < 1) format(String, sizeof(String), "%02d Minutos e %02d Segundos", MINUTOS_, SEGUNDOS_);
if(DIAS_ < 1 && HORAS_ < 1 && MINUTOS_ < 1) format(String, sizeof(String), "%02d Segundos", SEGUNDOS_);
if(DIAS_ > 3650) format(String, sizeof(String), "Permanente");
return String;
}
#define DaysToSeconds(%0) (%0 * 86400)
GetDateFromTime(timestamp)
{
new tm <tmStamp>, string[32];
localtime(Time:timestamp, tmStamp);
strftime(string, sizeof(string), "%d/%m/%y", tmStamp);
return string;
}
new ban_de_30_dias = DaysToSeconds(30) + gettime();

switch(Ban_Type)
{
case PERMANENTE: mysql_format(MyConection, MySQL_Format, sizeof MySQL_Format, "INSERT INTO `"TABLE_BAN"` (`"NOME"`, `"IP"`, `"DATA"`, `"BANIDO_POR"`, `"MOTIVO"`, `"TEMPO"`) VALUES ('%s', '%s', '%s', '%s', '%s', '%i')", Player_Name, Player_IP, FormatTimeDate, Ban_By, Reason, 20 * 12 * 30 * 24 * 60 * 60 + gettime());
case MINUTOS: mysql_format(MyConection, MySQL_Format, sizeof MySQL_Format, "INSERT INTO `"TABLE_BAN"` (`"NOME"`, `"IP"`, `"DATA"`, `"BANIDO_POR"`, `"MOTIVO"`, `"TEMPO"`) VALUES ('%s', '%s', '%s', '%s', '%s', '%i')", Player_Name, Player_IP, FormatTimeDate, Ban_By, Reason, Time * 60 + gettime());
case HORAS: mysql_format(MyConection, MySQL_Format, sizeof MySQL_Format, "INSERT INTO `"TABLE_BAN"` (`"NOME"`, `"IP"`, `"DATA"`, `"BANIDO_POR"`, `"MOTIVO"`, `"TEMPO"`) VALUES ('%s', '%s', '%s', '%s', '%s', '%i')", Player_Name, Player_IP, FormatTimeDate, Ban_By, Reason, Time * 60 * 60 + gettime());
case DIAS: mysql_format(MyConection, MySQL_Format, sizeof MySQL_Format, "INSERT INTO `"TABLE_BAN"` (`"NOME"`, `"IP"`, `"DATA"`, `"BANIDO_POR"`, `"MOTIVO"`, `"TEMPO"`) VALUES ('%s', '%s', '%s', '%s', '%s', '%i')", Player_Name, Player_IP, FormatTimeDate, Ban_By, Reason, Time * 24 * 60 * 60 + gettime());
}