jlalt

potato ban

Dec 31st, 2015
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.27 KB | None | 0 0
  1. CMD:tempban(playerid,params[]) {
  2.     if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][Level] >= 4) {
  3.             new strdate[128],strtime[128], player1, reason[50], byear,bmonth,bday;
  4.             if(sscanf(params,"iddds",player1,byear,bmonth,bday,reason)) {
  5.             SendClientMessage(playerid, 0xDC143CAA, "USAGE: /tempban [playerid] [years months days] [reason]");
  6.             printf("id: %d, Reason: %s, Years: %d, months: %d,days: %d",player1,reason,byear,bmonth,bday);
  7.             return SendClientMessage(playerid, 0xFF9900AA, "Example: /tempban 1 0 0 6 example [ player will be banned for six days ]");
  8.             }
  9.             new string[150];
  10.             if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
  11.                 new year,month,day,hour,minuite,second; getdate(year, month, day); gettime(hour,minuite,second);
  12.                 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);
  13.                 SendClientMessageToAll(COLOR_Silver,string);
  14.                 print(string);
  15.                 format(strdate, sizeof(strdate), "%d-%d-%d ",year,month,day);
  16.                 format(strtime,sizeof(strtime),"%d:%d:%d",hour,minuite,second);
  17.                 new tempbandate[3];
  18.                 tempbandate[0] = year+byear; tempbandate[1] = month+bmonth; tempbandate[2] = day+bday;
  19.                 tempbandate[0] *= 12;
  20.                 tempbandate[0] *= 30;
  21.                 tempbandate[1] *= 30;
  22.                 new expiredate1 = tempbandate[0]+tempbandate[1]+tempbandate[2];
  23.                 new Query[250];
  24.                 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));
  25.                 mysql_tquery(mysql, Query, "", ""); totalbans ++;
  26.                 format(Query, sizeof(Query),"INSERT INTO `bannedips`(`ip`) VALUES ('%s')",pIP(player1));
  27.                 mysql_tquery(mysql, Query, "", "");
  28.  
  29.                 return SetTimerEx("kickplayer", 500, false, "i", player1);
  30.             } else return SendClientMessage(playerid, 0xDC143CAA, "Player is not connected or is yourself or is the highest level admin");
  31.     } else return SendClientMessage(playerid,0xDC143CAA,"ERROR: You are not a high enough level to use this command");
  32. }
Advertisement
Add Comment
Please, Sign In to add comment