Advertisement
BR_Gustavo

Comando OTempBan IRC

Sep 16th, 2018
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.60 KB | None | 0 0
  1. forward IRCOTempBan(user[],channel[],Conta[],byear,bmonth,bday,reason[]);
  2. public IRCOTempBan(user[],channel[],Conta[],byear,bmonth,bday,reason[])
  3. {
  4.     new rows, fields;
  5.     cache_get_data(rows, fields, mysql);
  6.     new Query[250],saving[3][128],banned1;
  7.     if(!rows){ IRC_GroupSay(GrupoID,channel,"04ERROR: IP Not Exist on Database");}else
  8.     if(rows) {
  9.     cache_get_field_content(0, "name", saving[0], mysql, 128);
  10.     cache_get_field_content(0, "banned", saving[1], mysql, 32);
  11.     cache_get_field_content(0, "ip", saving[2], mysql, 32);
  12.     banned1 = strval(saving[1]);
  13.     if(banned1 == 0){
  14.     new year,month,day,hour,minuite,second; getdate(year, month, day); gettime(hour,minuite,second);
  15.     new tempbandate[4],strdate[128],strtime[128];
  16.     tempbandate[0] = 60 * 60 * 24 * (year+byear);
  17.     tempbandate[1] = 60 * 60 * 24 * 30 * (month+bmonth);
  18.     tempbandate[2] = 60 * 60 * 24 * (day+bday);
  19.     new expiredate1 = tempbandate[0]+tempbandate[1]+tempbandate[2];
  20.     new MsgMandarIRC[200];
  21.     format(MsgMandarIRC,sizeof(MsgMandarIRC),"70|- Account \"%s\" has temporary banned by administrator \"%s\" [Reason: %s] -|",saving[0],user,reason,day,month,year,hour,minuite);
  22.     IRC_GroupSay(GrupoID,IRC_CANAL,MsgMandarIRC);
  23.     IRC_GroupSay(GrupoID,IRC_OPERCANAL,MsgMandarIRC);
  24.     format(strdate, sizeof(strdate), "%d-%d-%d ",year,month,day);
  25.     format(strtime,sizeof(strtime),"%d:%d:%d",hour,minuite,second);
  26.     format(Query, sizeof(Query), "UPDATE `banneds` SET `ip` = '%s', `date` = '%s', `time` = '%s', `bannedby` = '%s', `tempban` = '%d', `reason` = '%s', `bdate` = '%d' WHERE `name` = '%s'",saving[2],strdate,strtime,user,1,reason,expiredate1,saving[0]);
  27.     mysql_tquery(mysql, Query, "", ""); totalbans ++;
  28.     format(Query, sizeof(Query),"INSERT INTO `bannedips`(`ip`) VALUES ('%s')",saving[2]);
  29.     mysql_tquery(mysql, Query, "", "");}}
  30.     return 1;
  31. }
  32. IRCCMD:otempban(botid,channel[],user[],host[],params[])
  33. {
  34.     if(IRC_IsOp(botid, channel, user)){
  35.     new name[MAX_PLAYER_NAME+5],reason[50],byear,bmonth,bday;
  36.     if(sscanf(params,"s[28]ddds[50]",name,byear,bmonth,bday,reason)){
  37.     IRC_GroupSay(GrupoID,channel,"04!tempban [account-name] [years months days] [reason]");
  38.     IRC_GroupSay(GrupoID,channel,"04!Example: !otempban 1 0 0 6 example [ account will be banned for six days ]");
  39.     return 1;}
  40.     new Query[250];
  41.     format(Query, sizeof(Query), "SELECT * FROM banneds WHERE `name` = '%s'", name);
  42.     format(banreason,sizeof banreason,"%s",reason);
  43.     mysql_tquery(mysql, Query, "IRCOTempBan", "sssddds",user,channel,name,byear,bmonth,bday,reason);}else{
  44.     IRC_GroupSay(GrupoID,channel,"04ERROR: You are not a high enough level to use this command");}
  45.     return 1;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement