daily pastebin goal
12%
SHARE
TWEET

Untitled

a guest Feb 13th, 2018 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CMD:banip(playerid, params[])
  2. {
  3.     if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
  4.     if(IsPlayerConnected(playerid))
  5.     {
  6.         if (PlayerInfo[playerid][pAdmin] >= 1)
  7.         {
  8.             new id,reason[128],string[200],giveplayer[30],sendername[30],days,str[1400],playerip[16],year,month,day,hour,minute,second,times;
  9.             if(sscanf(params, "uds[128]", id,days,reason)) return SCM(playerid,COLOR_WHITE,"{FF9900}Scrie: {33CCFF}/banip <Name/Playerid> <days(0=permanent)> <reason>");
  10.             if(days < 0) return SCM(playerid,COLOR_WHITE,"{FF9900}Scrie: {33CCFF}/banip <Name/Playerid> <days(0=permanent)> <reason>");
  11.             if(IsPlayerConnected(id))
  12.             {
  13.                 if(id != INVALID_PLAYER_ID)
  14.                 {
  15.                     getdate(year, month, day);
  16.                     gettime(hour, minute, second);
  17.                     GetPlayerName(id, giveplayer, sizeof(giveplayer));
  18.                     GetPlayerName(playerid, sendername, sizeof(sendername));
  19.                     GetPlayerIp(id, playerip, sizeof(playerip));
  20.                     if(PlayerInfo[id][pAdmin] >= PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, COLOR_GREY, "You can't ban a higher (or equal) level administrator.");
  21.                     if(days == 0)
  22.                     {
  23.                         format(string,sizeof(string),"IP Ban: %s has been permanent banned by %s, reason: %s.",giveplayer,sendername,reason);
  24.                         SendClientMessageToAll(COLOR_LIGHTRED, string);
  25.  
  26.  
  27.                         mysql_format(SQL,str,sizeof(str),"INSERT INTO bans (PlayerName, AdminName, Reason, IP, Days, IPBan, Permanent, Active, Time) VALUES('%s', '%s', '%s', '%s', 0, 1, 1, 1, 0)",
  28.                         PlayerInfo[id][pNormalName],PlayerInfo[playerid][pNormalName],reason,playerip);
  29.                         mysql_tquery(SQL,str,"","");
  30.                         new var100[256];
  31.                         mysql_format(SQL, var100, sizeof(var100), "INSERT INTO punishlogs (`playerid`,`giverid`,`actionid`,`actiontime`,`playername`,`givername`) VALUES ('%d','%d','3','0','%s','%s')", PlayerInfo[id][pSQLID],PlayerInfo[playerid][pSQLID],giveplayer,sendername);
  32.                         mysql_tquery(SQL,var100,"","");
  33.                         KickEx(id);
  34.                     }
  35.                     if(days > 0)
  36.                     {
  37.                         times = gettime() + (days*43200);
  38.                         format(string,sizeof(string),"IP Ban: %s has been banned by %s for %d days, reason: %s.",giveplayer,sendername,days,reason);
  39.                         SendClientMessageToAll(COLOR_LIGHTRED, string);
  40.  
  41.                        
  42.                         mysql_format(SQL,str,sizeof(str),"INSERT INTO bans (PlayerName, AdminName, Reason, IP, Days, IPBan, Permanent, Active, Time) VALUES('%s', '%s', '%s', '%s', %d, 1, 0, 1, %d)",
  43.                         PlayerInfo[id][pNormalName],PlayerInfo[playerid][pNormalName],reason,playerip,days,times);
  44.                         mysql_tquery(SQL,str,"","");
  45.                         new var100[256];
  46.                         mysql_format(SQL, var100, sizeof(var100), "INSERT INTO punishlogs (`playerid`,`giverid`,`actionid`,`actiontime`,`playername`,`givername`) VALUES ('%d','%d','4','%d','%s','%s')", PlayerInfo[id][pSQLID],PlayerInfo[playerid][pSQLID],days,giveplayer,sendername);
  47.                         mysql_tquery(SQL,var100,"","");
  48.                         KickEx(id);
  49.                     }
  50.                     new qqerry[128];
  51.                     mysql_format(SQL,qqerry, sizeof(qqerry), "UPDATE `users` SET `Status` = '0' WHERE `id` = '%d'", PlayerInfo[id][pSQLID]);
  52.                     mysql_tquery(SQL,qqerry,"","");
  53.                     mysql_format(SQL,qqerry, sizeof(qqerry), "UPDATE `friends` SET `Status` = '0' WHERE `FriendID` = '%d'", PlayerInfo[id][pSQLID]);
  54.                     mysql_tquery(SQL,qqerry,"","");
  55.                 }
  56.             }
  57.             else return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Player not connected.");
  58.         }
  59.         else return SendClientMessage(playerid, COLOR_DARKNICERED, AdminOnly);
  60.     }
  61.     return 1;
  62. }
RAW Paste Data
Top