jlalt

fixed

Dec 30th, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 10.91 KB | None | 0 0
  1. public BanCheck(playerid) {
  2.     new rows, fields,ibanned[10][2],ifbanned[2],save[4][80],Query[250];
  3.     cache_get_data(rows, fields, mysql);
  4.     if(rows)
  5.     {
  6.          format(Query, sizeof(Query),"UPDATE `banneds` SET `ip` = '%s' WHERE `name` = '%s'",pIP(playerid),pName(playerid));
  7.          mysql_tquery(mysql, Query, "", "");
  8.          cache_get_field_content(0, "banned", ibanned[0], mysql, 10);
  9.          ifbanned[0] = strval(ibanned[0]);
  10.          if(ifbanned[0] == 1) {
  11.          cache_get_field_content(0, "date", save[0], mysql, 80);
  12.          cache_get_field_content(0, "time", save[1], mysql, 80);
  13.          cache_get_field_content(0, "bannedby", save[2], mysql, 80);
  14.          cache_get_field_content(0, "reason", save[3], mysql, 80);
  15.          new str[350],content[128]; format(content,sizeof content,"%s %s",save[0],save[1]);
  16.          format(str, sizeof(str),"{C0C0C0}Your Account's currently Banned.\n\n{00FFFF}In-Game Name: {33FF33}%s\n{00FFFF}Administrator: {33FF33}%s\n{00FFFF}Date: {33FF33}%s\n{00FFFF}Reason: {33FF33}%s\n{C0C0C0}* if you think that you're banned wrongfully,\nfeel free to make unban appeal on our forum: forum",pName(playerid),save[2],content,save[3]);
  17.          ShowPlayerDialog(playerid, 801, DIALOG_STYLE_MSGBOX, "{FF0000}You Are Banned!", str, "Close","");
  18.          return SetTimerEx("kickplayer", 500, false, "i", playerid);
  19.          } else if(ifbanned[0] == 0) {
  20.          cache_get_field_content(0, "tempban", ibanned[1], mysql, 10);
  21.          ifbanned[1] = strval(ibanned[1]);
  22.          if(ifbanned[1] == 1) {
  23.          new whatdate;
  24.          whatdate = cache_get_field_content_int(0,"bdate",mysql);
  25.          new Year,Month,Day,string;
  26.          getdate(Year, Month, Day);
  27.          Year *= 12;
  28.          Year *= 30;
  29.          Month *= 30;
  30.          string = Year+Month+Day;
  31.          printf("%d %d",whatdate,string);
  32.          if(whatdate - string <= 0) {
  33.            format(Query, sizeof(Query),"UPDATE `banneds` SET `tempban` = 0,`bannedby` = %d,`reason` = %d WHERE `name` = '%s'",0,0,pName(playerid));
  34.            mysql_tquery(mysql, Query, "", "");
  35.            format(Query, 100, "DELETE FROM `bannedips` WHERE `ip` = '%s'",pIP(playerid));
  36.            mysql_tquery(mysql, Query, "", "");
  37.            return SendClientMessage(playerid, 0x33FF33AA,"Ban BOT: |- Your Ban Has been Expired -|");
  38.          }
  39.          new saves[3][128],by[128],expire;
  40.          cache_get_field_content(0, "date", saves[0], mysql, 128);
  41.          cache_get_field_content(0, "time", saves[1], mysql, 128);
  42.          cache_get_field_content(0, "reason", saves[2], mysql, 128);
  43.          cache_get_field_content(0, "bannedby", by, mysql, 128);
  44.          expire = cache_get_field_content_int(0, "bdate",mysql);
  45.          new str[350],content[128]; format(content,sizeof content,"%s %s",saves[0],saves[1]);
  46.          expire -= string;
  47.          format(str, sizeof(str),"{C0C0C0}Your Account's currently Banned.\n\n{00FFFF}In-Game Name: {33FF33}%s\n{00FFFF}Administrator: {33FF33}%s\n{00FFFF}Date: {33FF33}%s\n{00FFFF}Reason: {33FF33}%s\n{00FFFF}Ban Expire After: {33FF33}%d Days\n{C0C0C0}* if you think that you're banned wrongfully,\nfeel free to make unban appeal on our forum: forum"\
  48.          ,pName(playerid),by,content,saves[2],expire);
  49.          ShowPlayerDialog(playerid, 801, DIALOG_STYLE_MSGBOX, "{FF0000}You Are Temporary Banned!", str, "Close","");
  50.          return SetTimerEx("kickplayer", 500, false, "i", playerid);
  51.          }
  52.       }
  53.     }
  54.     if(!rows)
  55.     {
  56.      format(Query, sizeof(Query), "SELECT * FROM `bannedips` WHERE `ip` = '%s'", pIP(playerid));
  57.      mysql_tquery(mysql, Query, "BanIPCheck", "i", playerid);
  58.      }
  59.     return 1;
  60. }
  61. public Baninfo(playerid) {
  62.    new rows, fields;
  63.    cache_get_data(rows, fields, mysql);
  64.    if(rows)
  65.       {
  66.        new save[5][50],save5[128],banned1,str[350],str2[80],datetime[50];
  67.        cache_get_field_content(0, "banned", save[0], mysql, 10);
  68.        banned1 = strval(save[0]);
  69.        if(banned1 == 1) {
  70.          cache_get_field_content(0, "date", save[1], mysql, 50);
  71.          cache_get_field_content(0, "time", save[2], mysql, 50);
  72.          cache_get_field_content(0, "bannedby", save[3], mysql, 50);
  73.          cache_get_field_content(0, "name", save[4], mysql, 50);
  74.          cache_get_field_content(0, "reason", save5, mysql, 128);
  75.          format(str2,sizeof(str2),"%s Ban Information",save[4]);
  76.          format(datetime,sizeof(datetime),"%s %s",save[1],save[2]);
  77.          format(str, sizeof(str),"{00FFFF}Player Name: {33FF33}%s\n{00FFFF}Banned By: {33FF33}%s\n{00FFFF}Date: {33FF33}%s\n{00FFFF}Reason: {33FF33}%s",save[4],save[3],datetime,save5);
  78.          ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, str2, str, "Close","");
  79.        } if(banned1 == 0) {
  80.          cache_get_field_content(0, "tempban", save[0], mysql, 10);
  81.          banned1 = strval(save[0]);
  82.          if(banned1 == 1) {
  83.            new saves[3][128],by[128],expire;
  84.            cache_get_field_content(0, "date", saves[0], mysql, 128);
  85.            cache_get_field_content(0, "time", saves[1], mysql, 128);
  86.            cache_get_field_content(0, "reason", saves[2], mysql, 128);
  87.            cache_get_field_content(0, "name", save[4], mysql, 50);
  88.            cache_get_field_content(0, "bannedby", by, mysql, 128);
  89.            expire = cache_get_field_content_int(0, "bdate", mysql);
  90.            new content[128]; format(content,sizeof content,"%s %s",saves[0],saves[1]);
  91.            format(str2,sizeof(str2),"%s Ban Information",save[4]);
  92.            new date,Year,Month,Day;
  93.            getdate(Year,Month,Day);
  94.            Year *= 12;
  95.            Year *= 30;
  96.            Month *= 30;
  97.            date = Year+Month+Day;
  98.            expire -= date;
  99.            format(str, sizeof(str),"{00FFFF}Player Name: {33FF33}%s\n{00FFFF}Banned By: {33FF33}%s\n{00FFFF}Date: {33FF33}%s\n{00FFFF}Reason: {33FF33}%s\n{00FFFF}Ban Expire After: {33FF33}%d Days"
  100.            ,save[4],by,content,saves[2],expire);
  101.            ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, str2, str, "Close","");
  102.        }
  103.        } else return SendClientMessage(playerid,0xDC143CAA,"ERROR: This player is not banned");
  104.    } else return SendClientMessage(playerid,0xDC143CAA,"ERROR: Player Name not Exist on database");
  105.    return 1;
  106. }
  107.  
  108. public DBaninfo(playerid) {
  109.    new rows, fields;
  110.    cache_get_data(rows, fields, mysql);
  111.    if(rows)
  112.     {
  113.        new save[5][50],save5[128],banned1,str[350],str2[80],datetime[50];
  114.        cache_get_field_content(0, "banned", save[0], mysql, 10);
  115.        banned1 = strval(save[0]);
  116.        if(banned1 == 1) {
  117.          cache_get_field_content(0, "date", save[1], mysql, 50);
  118.          cache_get_field_content(0, "time", save[2], mysql, 50);
  119.          cache_get_field_content(0, "bannedby", save[3], mysql, 50);
  120.          cache_get_field_content(0, "name", save[4], mysql, 50);
  121.          cache_get_field_content(0, "reason", save5, mysql, 128);
  122.          format(str2,sizeof(str2),"%s Ban Information",save[4]);
  123.          format(datetime,sizeof(datetime),"%s %s",save[1],save[2]);
  124.          format(str, sizeof(str),"{00FFFF}Player Name: {33FF33}%s\n{00FFFF}Banned By: {33FF33}%s\n{00FFFF}Date: {33FF33}%s\n{00FFFF}Reason: {33FF33}%s",save[4],save[3],datetime,save5);
  125.          ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, str2, str, "Close","");
  126.        } if(banned1 == 0) {
  127.          cache_get_field_content(0, "tempban", save[0], mysql, 10);
  128.          banned1 = strval(save[0]);
  129.          if(banned1 == 1) {
  130.            new saves[3][128],by[128],expire;
  131.            cache_get_field_content(0, "date", saves[0], mysql, 128);
  132.            cache_get_field_content(0, "time", saves[1], mysql, 128);
  133.            cache_get_field_content(0, "reason", saves[2], mysql, 128);
  134.            cache_get_field_content(0, "name", save[4], mysql, 50);
  135.            cache_get_field_content(0, "bannedby", by, mysql, 128);
  136.            expire = cache_get_field_content_int(0, "bdate",mysql);
  137.            new content[128]; format(content,sizeof content,"%s %s",saves[0],saves[1]);
  138.            format(str2,sizeof(str2),"%s Ban Information",save[4]);
  139.            new date,Year,Month,Day;
  140.            getdate(Year,Month,Day);
  141.            Year *= 12;
  142.            Year *= 30;
  143.            Month *= 30;
  144.            date = Year+Month+Day;
  145.            expire -= date;
  146.            format(str, sizeof(str),"{00FFFF}Player Name: {33FF33}%s\n{00FFFF}Banned By: {33FF33}%s\n{00FFFF}Date: {33FF33}%s\n{00FFFF}Reason: {33FF33}%s\n{00FFFF}Ban Expire After: {33FF33}%d Days"
  147.            ,save[4],by,content,saves[2],expire);
  148.            ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, str2, str, "Close","");
  149.          } else return ShowPlayerDialog(playerid, 2648, DIALOG_STYLE_INPUT, "Ban List", "Player name you entered are not banned", "Search", "Close");
  150.        }
  151.    } else return ShowPlayerDialog(playerid, 2648, DIALOG_STYLE_INPUT, "Ban List", "No bans were found.", "Search", "Close");
  152.    return 1;
  153. }
  154. CMD:tempban(playerid,params[]) {
  155.     if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][Level] >= 4) {
  156.             new strdate[128],strtime[128], player1, reason[50], byear,bmonth,bday;
  157.             if(sscanf(params,"iddds",player1,byear,bmonth,bday,reason)) {
  158.             SendClientMessage(playerid, 0xDC143CAA, "USAGE: /tempban [playerid] [years months days] [reason]");
  159.             printf("id: %d, Reason: %s, Years: %d, months: %d,days: %d",player1,reason,byear,bmonth,bday);
  160.             return SendClientMessage(playerid, 0xFF9900AA, "Example: /tempban 1 0 0 6 example [ player will be banned for six days ]");
  161.             }
  162.             new string[150];
  163.             if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
  164.                 new year,month,day,hour,minuite,second; getdate(year, month, day); gettime(hour,minuite,second);
  165.                 format(string,sizeof(string),"|- %s has been temporary banned by Administrator %s [Reason: %s] [Date: %d/%d/%d] [Time: %d:%d] -|",pName(player1),pName(playerid),reason,day,month,year,hour,minuite);
  166.                 SendClientMessageToAll(COLOR_Silver,string);
  167.                 print(string);
  168.                 format(strdate, sizeof(strdate), "%d-%d-%d ",year,month,day);
  169.                 format(strtime,sizeof(strtime),"%d:%d:%d",hour,minuite,second);
  170.                 new tempbandate[3];
  171.                 tempbandate[0] = year+byear; tempbandate[1] = month+bmonth; tempbandate[2] = day+bday;
  172.                 tempbandate[0] *= 12;
  173.                 tempbandate[0] *= 30;
  174.                 tempbandate[1] *= 30;
  175.                 new expiredate1 = tempbandate[0]+tempbandate[1]+tempbandate[2];
  176.                 new Query[250];
  177.                 format(Query, sizeof(Query), "UPDATE `banneds` SET `ip` = '%s', `date` = '%s', `time` = '%s', `bannedby` = '%s', `tempban` = '%d', `reason` = '%s', `bdate` = '%d' WHERE `name` = '%s'", pIP(player1),strdate,strtime,pName(playerid),1,reason,expiredate1,pName(player1));
  178.                 mysql_tquery(mysql, Query, "", ""); totalbans ++;
  179.                 format(Query, sizeof(Query),"INSERT INTO `bannedips`(`ip`) VALUES ('%s')",pIP(player1));
  180.                 mysql_tquery(mysql, Query, "", "");
  181.  
  182.                 return SetTimerEx("kickplayer", 500, false, "i", player1);
  183.             } else return SendClientMessage(playerid, 0xDC143CAA, "Player is not connected or is yourself or is the highest level admin");
  184.     } else return SendClientMessage(playerid,0xDC143CAA,"ERROR: You are not a high enough level to use this command");
  185. }
Advertisement
Add Comment
Please, Sign In to add comment