Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public BanCheck(playerid) {
- new rows, fields,ibanned[10][2],ifbanned[2],save[4][80],Query[250];
- cache_get_data(rows, fields, mysql);
- if(rows)
- {
- format(Query, sizeof(Query),"UPDATE `banneds` SET `ip` = '%s' WHERE `name` = '%s'",pIP(playerid),pName(playerid));
- mysql_tquery(mysql, Query, "", "");
- cache_get_field_content(0, "banned", ibanned[0], mysql, 10);
- ifbanned[0] = strval(ibanned[0]);
- if(ifbanned[0] == 1) {
- cache_get_field_content(0, "date", save[0], mysql, 80);
- cache_get_field_content(0, "time", save[1], mysql, 80);
- cache_get_field_content(0, "bannedby", save[2], mysql, 80);
- cache_get_field_content(0, "reason", save[3], mysql, 80);
- new str[350],content[128]; format(content,sizeof content,"%s %s",save[0],save[1]);
- 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]);
- ShowPlayerDialog(playerid, 801, DIALOG_STYLE_MSGBOX, "{FF0000}You Are Banned!", str, "Close","");
- return SetTimerEx("kickplayer", 500, false, "i", playerid);
- } else if(ifbanned[0] == 0) {
- cache_get_field_content(0, "tempban", ibanned[1], mysql, 10);
- ifbanned[1] = strval(ibanned[1]);
- if(ifbanned[1] == 1) {
- new whatdate;
- whatdate = cache_get_field_content_int(0,"bdate",mysql);
- new Year,Month,Day,string;
- getdate(Year, Month, Day);
- Year *= 12;
- Year *= 30;
- Month *= 30;
- string = Year+Month+Day;
- printf("%d %d",whatdate,string);
- if(whatdate - string <= 0) {
- format(Query, sizeof(Query),"UPDATE `banneds` SET `tempban` = 0,`bannedby` = %d,`reason` = %d WHERE `name` = '%s'",0,0,pName(playerid));
- mysql_tquery(mysql, Query, "", "");
- format(Query, 100, "DELETE FROM `bannedips` WHERE `ip` = '%s'",pIP(playerid));
- mysql_tquery(mysql, Query, "", "");
- return SendClientMessage(playerid, 0x33FF33AA,"Ban BOT: |- Your Ban Has been Expired -|");
- }
- new saves[3][128],by[128],expire;
- cache_get_field_content(0, "date", saves[0], mysql, 128);
- cache_get_field_content(0, "time", saves[1], mysql, 128);
- cache_get_field_content(0, "reason", saves[2], mysql, 128);
- cache_get_field_content(0, "bannedby", by, mysql, 128);
- expire = cache_get_field_content_int(0, "bdate",mysql);
- new str[350],content[128]; format(content,sizeof content,"%s %s",saves[0],saves[1]);
- expire -= string;
- 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"\
- ,pName(playerid),by,content,saves[2],expire);
- ShowPlayerDialog(playerid, 801, DIALOG_STYLE_MSGBOX, "{FF0000}You Are Temporary Banned!", str, "Close","");
- return SetTimerEx("kickplayer", 500, false, "i", playerid);
- }
- }
- }
- if(!rows)
- {
- format(Query, sizeof(Query), "SELECT * FROM `bannedips` WHERE `ip` = '%s'", pIP(playerid));
- mysql_tquery(mysql, Query, "BanIPCheck", "i", playerid);
- }
- return 1;
- }
- public Baninfo(playerid) {
- new rows, fields;
- cache_get_data(rows, fields, mysql);
- if(rows)
- {
- new save[5][50],save5[128],banned1,str[350],str2[80],datetime[50];
- cache_get_field_content(0, "banned", save[0], mysql, 10);
- banned1 = strval(save[0]);
- if(banned1 == 1) {
- cache_get_field_content(0, "date", save[1], mysql, 50);
- cache_get_field_content(0, "time", save[2], mysql, 50);
- cache_get_field_content(0, "bannedby", save[3], mysql, 50);
- cache_get_field_content(0, "name", save[4], mysql, 50);
- cache_get_field_content(0, "reason", save5, mysql, 128);
- format(str2,sizeof(str2),"%s Ban Information",save[4]);
- format(datetime,sizeof(datetime),"%s %s",save[1],save[2]);
- 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);
- ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, str2, str, "Close","");
- } if(banned1 == 0) {
- cache_get_field_content(0, "tempban", save[0], mysql, 10);
- banned1 = strval(save[0]);
- if(banned1 == 1) {
- new saves[3][128],by[128],expire;
- cache_get_field_content(0, "date", saves[0], mysql, 128);
- cache_get_field_content(0, "time", saves[1], mysql, 128);
- cache_get_field_content(0, "reason", saves[2], mysql, 128);
- cache_get_field_content(0, "name", save[4], mysql, 50);
- cache_get_field_content(0, "bannedby", by, mysql, 128);
- expire = cache_get_field_content_int(0, "bdate", mysql);
- new content[128]; format(content,sizeof content,"%s %s",saves[0],saves[1]);
- format(str2,sizeof(str2),"%s Ban Information",save[4]);
- new date,Year,Month,Day;
- getdate(Year,Month,Day);
- Year *= 12;
- Year *= 30;
- Month *= 30;
- date = Year+Month+Day;
- expire -= date;
- 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"
- ,save[4],by,content,saves[2],expire);
- ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, str2, str, "Close","");
- }
- } else return SendClientMessage(playerid,0xDC143CAA,"ERROR: This player is not banned");
- } else return SendClientMessage(playerid,0xDC143CAA,"ERROR: Player Name not Exist on database");
- return 1;
- }
- public DBaninfo(playerid) {
- new rows, fields;
- cache_get_data(rows, fields, mysql);
- if(rows)
- {
- new save[5][50],save5[128],banned1,str[350],str2[80],datetime[50];
- cache_get_field_content(0, "banned", save[0], mysql, 10);
- banned1 = strval(save[0]);
- if(banned1 == 1) {
- cache_get_field_content(0, "date", save[1], mysql, 50);
- cache_get_field_content(0, "time", save[2], mysql, 50);
- cache_get_field_content(0, "bannedby", save[3], mysql, 50);
- cache_get_field_content(0, "name", save[4], mysql, 50);
- cache_get_field_content(0, "reason", save5, mysql, 128);
- format(str2,sizeof(str2),"%s Ban Information",save[4]);
- format(datetime,sizeof(datetime),"%s %s",save[1],save[2]);
- 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);
- ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, str2, str, "Close","");
- } if(banned1 == 0) {
- cache_get_field_content(0, "tempban", save[0], mysql, 10);
- banned1 = strval(save[0]);
- if(banned1 == 1) {
- new saves[3][128],by[128],expire;
- cache_get_field_content(0, "date", saves[0], mysql, 128);
- cache_get_field_content(0, "time", saves[1], mysql, 128);
- cache_get_field_content(0, "reason", saves[2], mysql, 128);
- cache_get_field_content(0, "name", save[4], mysql, 50);
- cache_get_field_content(0, "bannedby", by, mysql, 128);
- expire = cache_get_field_content_int(0, "bdate",mysql);
- new content[128]; format(content,sizeof content,"%s %s",saves[0],saves[1]);
- format(str2,sizeof(str2),"%s Ban Information",save[4]);
- new date,Year,Month,Day;
- getdate(Year,Month,Day);
- Year *= 12;
- Year *= 30;
- Month *= 30;
- date = Year+Month+Day;
- expire -= date;
- 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"
- ,save[4],by,content,saves[2],expire);
- ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, str2, str, "Close","");
- } else return ShowPlayerDialog(playerid, 2648, DIALOG_STYLE_INPUT, "Ban List", "Player name you entered are not banned", "Search", "Close");
- }
- } else return ShowPlayerDialog(playerid, 2648, DIALOG_STYLE_INPUT, "Ban List", "No bans were found.", "Search", "Close");
- return 1;
- }
- CMD:tempban(playerid,params[]) {
- if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][Level] >= 4) {
- new strdate[128],strtime[128], player1, reason[50], byear,bmonth,bday;
- if(sscanf(params,"iddds",player1,byear,bmonth,bday,reason)) {
- SendClientMessage(playerid, 0xDC143CAA, "USAGE: /tempban [playerid] [years months days] [reason]");
- printf("id: %d, Reason: %s, Years: %d, months: %d,days: %d",player1,reason,byear,bmonth,bday);
- return SendClientMessage(playerid, 0xFF9900AA, "Example: /tempban 1 0 0 6 example [ player will be banned for six days ]");
- }
- new string[150];
- if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
- new year,month,day,hour,minuite,second; getdate(year, month, day); gettime(hour,minuite,second);
- 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);
- SendClientMessageToAll(COLOR_Silver,string);
- print(string);
- format(strdate, sizeof(strdate), "%d-%d-%d ",year,month,day);
- format(strtime,sizeof(strtime),"%d:%d:%d",hour,minuite,second);
- new tempbandate[3];
- tempbandate[0] = year+byear; tempbandate[1] = month+bmonth; tempbandate[2] = day+bday;
- tempbandate[0] *= 12;
- tempbandate[0] *= 30;
- tempbandate[1] *= 30;
- new expiredate1 = tempbandate[0]+tempbandate[1]+tempbandate[2];
- new Query[250];
- 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));
- mysql_tquery(mysql, Query, "", ""); totalbans ++;
- format(Query, sizeof(Query),"INSERT INTO `bannedips`(`ip`) VALUES ('%s')",pIP(player1));
- mysql_tquery(mysql, Query, "", "");
- return SetTimerEx("kickplayer", 500, false, "i", player1);
- } else return SendClientMessage(playerid, 0xDC143CAA, "Player is not connected or is yourself or is the highest level admin");
- } else return SendClientMessage(playerid,0xDC143CAA,"ERROR: You are not a high enough level to use this command");
- }
Advertisement
Add Comment
Please, Sign In to add comment