Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- // configuração
- new DB:Banidos;
- forward KickEx(playerid);
- public OnGameModeInit()
- {
- Banidos = db_open("Banidos.db");
- db_query(Banidos, "CREATE TABLE IF NOT EXISTS `Banidos` (`Admin`,`Banido`,`Dias`,`Motivo`,`Data`)");
- print("\n-------------------------------------------------\n");
- print("Ban Syssstem Carregado com sucesso! versão 0.2 By: Pain Nagato");
- print("\n-------------------------------------------------\n");
- return 1;
- }
- #if defined _ALS_OnGameModeInit
- #undef OnGameModeInit
- #else
- #define _ALS_OnGameModeInit
- #endif
- #define OnGameModeInit PainNagato_OnGameModeInit
- #if defined PainNagato_OnGameModeInit
- forward PainNagato_OnGameModeInit();
- #endif
- public OnPlayerConnect(playerid)
- {
- return OnPlayerCheckBan(playerid);
- }
- #if defined _ALS_OnPlayerConnect
- #undef OnPlayerConnect
- #else
- #define _ALS_OnPlayerConnect
- #endif
- #define OnPlayerConnect PainNagato_OnPlayerConnect
- #if defined PainNagato_OnPlayerConnect
- forward PainNagato_OnPlayerConnect(playerid);
- #endif
- stock SetBanPlayerEx(adminban, banid , days, const reason[]) // banir o player com parametros a mais
- {
- new file2[50], Query[300] , a, m , d , h , mi , s;
- getdate(a,m,d);
- gettime(h,mi,s);
- format(file2, sizeof(file2), "%02d/%02d/%d - %02d:%02d:%02d", d , m , a , h , mi , s);
- format(Query, sizeof(Query), "INSERT INTO `Banidos` (`Admin`,`Banido`,`Dias`,`Motivo`,`Data`) VALUES ('%s','%s','%d','%s','%s')", GetNameId(adminban), GetNameId(banid), days * 86400 + gettime() , reason , file2);
- db_free_result(db_query(Banidos, Query));
- GameTextForPlayer(banid, "~r~BANIDO" , 5000 , 5);
- SetTimerEx("KickEx" , 200 , false , "i" , banid);
- return 1;
- }
- stock SetBanPlayer(banid, days, const reason[]) // banir o player
- {
- new Query[300] , file2[50] , a, m , d , h , mi , s;
- getdate(a,m,d);
- gettime(h,mi,s);
- format(file2, sizeof(file2), "%02d/%02d/%d - %02d:%02d:%02d", d , m , a , h , mi , s);
- format(Query, sizeof(Query), "INSERT INTO `Banidos` (`Admin`,`Banido`,`Dias`,`Motivo`,`Data`) VALUES ('BOT-ADMIN','%s','%d','%s','%s')", GetNameId(banid), days * 86400 + gettime(), reason , file2);
- db_free_result(db_query(Banidos, Query));
- GameTextForPlayer(banid, "~r~BANIDO" , 5000 , 5);
- SetTimerEx("KickEx" , 200 , false , "i" , banid);
- return 1;
- }
- stock GetNameId(playerid)
- {
- new name[MAX_PLAYER_NAME+1];
- GetPlayerName(playerid, name , MAX_PLAYER_NAME+1);
- return name;
- }
- stock ConverterNumeros(n) // by DanDRT
- {
- new dia, hr, mn, seg, resto;
- resto = n;
- seg = resto % 60;
- resto /= 60;
- mn = resto % 60;
- resto /= 60;
- hr = resto % 24;
- resto /= 24;
- dia = resto;
- new str[50];
- format(str, sizeof(str), "%ddias, %02dh %02dm %02ds", dia, hr, mn, seg);
- return str;
- }
- stock OnPlayerCheckBan(playerid) // checar se está banido
- {
- new query[300] , DBResult:result;
- format(query, sizeof(query) , "SELECT * FROM `Banidos` WHERE `Banido` = '%s'" , GetNameId(playerid));
- result = db_query(Banidos, query);
- if(db_num_rows(result) == 0) print("Não existe nenhuma conta ");
- new AdminBan[25] , Days , Data[50] , Motivo[64] , string[200];
- new Field[100];
- db_get_field_assoc(result, "Admin", Field, sizeof(Field));
- format(AdminBan, sizeof(AdminBan) , Field);
- db_get_field_assoc(result, "Dias", Field, sizeof(Field));
- Days = strval(Field);
- db_get_field_assoc(result, "Data", Field, sizeof(Field));
- format(Data, sizeof(Data) , Field);
- db_get_field_assoc(result, "Motivo", Field, sizeof(Field));
- format(Motivo, sizeof(Motivo) , Field);
- if(Days < gettime())
- {
- format(query, sizeof query , "DELETE FROM `Banidos` WHERE `Banido` = '%s'" , GetNameId(playerid));
- db_query(Banidos, query);
- }
- else
- {
- format(string, sizeof(string), "{FFFF00}Admin: {FFFFFF}%s\n{FFFF00}Conta Banida: {FFFFFF}%s\n{FFFF00}Dias Restante: {FFFFFF}%s\n{FFFF00}Data: {FFFFFF}%s\n{FFFF00}Motivo: {FFFFFF}%s", AdminBan , GetNameId(playerid), ConverterNumeros(Days - gettime()) , Data , Motivo);
- ShowPlayerDialog(playerid, 9898 , DIALOG_STYLE_MSGBOX , "{FFFFFF}Conta {FF0000}Banida", string , "Fechar" , "");
- SetTimerEx("KickEx", 500 , false , "i" , playerid);
- }
- return 1;
- }
- stock RemoveBanPlayer(const bannick[]) // remover o ban
- {
- new query[300] , DBResult:result;
- format(query, sizeof query , "SELECT * FROM `Banidos` WHERE `Banido` = '%s'" , bannick);
- result = db_query(Banidos, query);
- if(db_num_rows(result) == 0) printf("Essa conta %s não está banida", bannick);
- format(query, sizeof query , "DELETE FROM `Banidos` WHERE `Banido` = '%s'", bannick);
- db_query(Banidos, query);
- return 1;
- }
- stock EditBanPlayer(const bannick[] , days , const reason[]) // editar o ban
- {
- new query[300] , DBResult:result;
- format(query, sizeof query , "SELECT * FROM `Banidos` WHERE `Banido` = '%s'" , bannick);
- result = db_query(Banidos, query);
- if(db_num_rows(result) == 0) return false;
- format(query, sizeof query , "UPDATE `Banidos` SET `Banido` = '%s' WHERE `Dias` = '%d' WHERE `Motivo` = '%s'" , bannick , days * 86400 + gettime() , reason);
- db_query(Banidos, query);
- return 1;
- }
- stock ScheduleBanPlayer(adminban, const bannick[] , days , const reason[]) // agendar ban
- {
- new query[300] , file2[50] , a, m , d , h , mi , s;
- getdate(a,m,d);
- gettime(h,mi,s);
- format(file2, sizeof(file2), "%02d/%02d/%d - %02d:%02d:%02d", d , m , a , h , mi , s);
- format(query, sizeof(query) , "INSERT INTO `Banidos` (`Admin`,`Banido`,`Dias`,`Data`,`Motivo`) VALUES('%s','%s','%d','%s','%s')", GetNameId(adminban), bannick , days * 86400 + gettime() , file2 , reason);
- db_query(Banidos, query);
- return 1;
- }
- public KickEx(playerid) return Kick(playerid);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement