Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include a_samp
- #include a_mysql
- #include zcmd
- #define red 0xFF0000AA
- #define COLOR_Silver 0xCACACAAA
- //==================================News======================================//
- new offlineb[MAX_PLAYERS],
- banned[MAX_PLAYERS],
- whatunbanip[32],
- banreason[128],
- whatbanip[32],
- totalbans,
- totalip,
- mysql
- ;
- //====================================Forwards================================//
- forward BanCheck(playerid);
- forward BanIPCheck(playerid);
- forward kickplayer(playerid);
- forward Unban(playerid);
- forward Unbanip(playerid);
- forward Banip(playerid);
- forward Baninfo(playerid);
- forward DBaninfo(playerid);
- forward offlineban(playerid,reason[]);
- forward TotalBans();
- forward TotalBans1();
- forward Totalbanips();
- //============================================================================//
- public OnFilterScriptInit()
- {
- mysql_log(LOG_ERROR | LOG_WARNING | LOG_DEBUG);
- mysql = mysql_connect("HOST", "USER_NAME", "DATABASE", "PASSWORD");
- if(mysql_errno(mysql) != 0)
- {
- print("Could not connect to database!");
- }
- else
- {
- print("Successfully connected on DB ");
- new Query[250];
- format(Query,sizeof(Query),"CREATE TABLE IF NOT EXISTS banneds(name VARCHAR(128), ip VARCHAR(128), date VARCHAR(128), time VARCHAR(128)\
- ,bannedby VARCHAR(128), banned INT(10), reason VARCHAR(128), bdate VARCHAR(128), tempban INT(10) )");
- mysql_tquery(mysql, Query, "", "");
- format(Query,sizeof(Query),"CREATE TABLE IF NOT EXISTS bannedips(ip VARCHAR(128) )");
- mysql_tquery(mysql, Query, "", "");
- mysql_format(mysql, Query, sizeof(Query),"SELECT * FROM `banneds` WHERE `banned` = 1");
- mysql_tquery(mysql, Query, "TotalBans", "");
- mysql_format(mysql, Query, sizeof(Query),"SELECT * FROM `banneds` WHERE `tempban` = 1");
- mysql_tquery(mysql, Query, "Totalbans1", "");
- mysql_format(mysql, Query, sizeof(Query),"SELECT * FROM `bannedips`");
- mysql_tquery(mysql, Query, "Totalbanips", "");
- }
- return 1;
- }
- public TotalBans() {
- new rows, fields;
- cache_get_data(rows, fields, mysql);
- if(rows) {
- totalbans += rows;
- }
- }
- public TotalBans1() {
- new rows, fields;
- cache_get_data(rows, fields, mysql);
- if(rows) {
- totalbans += rows;
- }
- }
- public Totalbanips() {
- new rows, fields;
- cache_get_data(rows, fields, mysql);
- if(rows) {
- totalip += rows;
- }
- }
- public OnFilterScriptExit() {
- mysql_close();
- }
- public OnPlayerConnect(playerid) {
- banned[playerid] = 0;
- new Query[250];
- mysql_format(mysql, Query, sizeof(Query),"SELECT * FROM `banneds` WHERE `name` = '%e' LIMIT 1", pName(playerid));
- mysql_tquery(mysql, Query, "BanCheck", "i", playerid);
- return 1;
- }
- CMD:ban(playerid,params[]) {
- if(IsPlayerAdmin(playerid)) {
- new strdate[128],strtime[128], tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
- if(!strlen(params)) return SendClientMessage(playerid, 0xDC143CAA, "USAGE: /ban [playerid] [reason]");
- if(!strlen(tmp2)) return SendClientMessage(playerid, 0xDC143CAA, "ERROR: You must give a reason");
- new player1, ip[128], string[128];
- player1 = strval(tmp);
- if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && !IsPlayerAdmin(player1)) {
- GetPlayerIp(playerid,ip,sizeof(ip));
- new year,month,day,hour,minuite,second; getdate(year, month, day); gettime(hour,minuite,second);
- format(string,sizeof(string),"|- %s has been banned by Administrator %s [Reason: %s] [Date: %d/%d/%d] [Time: %d:%d] -|",pName(player1),pName(playerid),params[2],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 Query[250];
- format(Query, sizeof(Query), "UPDATE `banneds` SET `ip` = '%s', `date` = '%s', `time` = '%s', `bannedby` = '%s', `banned` = '%d', `reason` = '%s' WHERE `name` = '%s'", ip,strdate,strtime,pName(playerid),1,params[2],pName(playerid));
- mysql_tquery(mysql, Query, "", ""); totalbans ++;
- format(Query, sizeof(Query),"INSERT INTO `bannedips`(`ip`) VALUES ('%s')",ip);
- mysql_tquery(mysql, Query, "", ""); totalip ++;
- return SetTimerEx("kickplayer", 500, false, "i", tmp);
- } 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");
- }
- CMD:tempban(playerid,params[]) {
- if(IsPlayerAdmin(playerid)) {
- new strdate[128],strtime[128], player1w[128], reason[128], byearw[128],bmonthw[128],bdayw[128], Index; player1w = strtok(params,Index), reason = strtok(params,Index); byearw = strtok(params,Index), bmonthw = strtok(params,Index), bdayw = strtok(params,Index);
- if(!strlen(player1w)) {
- SendClientMessage(playerid, 0xDC143CAA, "USAGE: /tempban [playerid] [reason] [years months days]");
- return SendClientMessage(playerid, 0xFF9900AA, "Example: /tempban 1 example 0 0 6 [ player will be banned for six days ]");
- }
- if(!strlen(reason)) return SendClientMessage(playerid, red, "ERROR: You must give a reason");
- if(!strlen(byearw)) return SendClientMessage(playerid, red, "ERROR: You must give a year");
- if(!strlen(bmonthw)) return SendClientMessage(playerid, red, "ERROR: You must give a month");
- if(!strlen(bdayw)) return SendClientMessage(playerid, red, "ERROR: You must give a day");
- new player1n,byearn,bmonthn,bdayn,ip[128], string[150];
- player1n = strval(player1w); byearn = strval(byearw); bmonthn = strval(bmonthw); bdayn = strval(bdayw);
- if(IsPlayerConnected(player1n) && player1n != INVALID_PLAYER_ID) {
- GetPlayerIp(playerid,ip,sizeof(ip));
- 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(player1n),pName(playerid),params[2],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],bandate[128];
- tempbandate[0] = year+byearn; tempbandate[1] = month+bmonthn; tempbandate[2] = day+bdayn;
- format(bandate,sizeof bandate,"%d-%d-%d",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` = '%s' WHERE `name` = '%s'", ip,strdate,strtime,pName(playerid),1,params[2],bandate,pName(player1n));
- mysql_tquery(mysql, Query, "", ""); printf("%s",Query); totalbans ++;
- format(Query, sizeof(Query),"INSERT INTO `bannedips`(`ip`) VALUES ('%s')",ip);
- mysql_tquery(mysql, Query, "", ""); totalip ++;
- return SetTimerEx("kickplayer", 500, false, "i", player1n);
- } 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");
- }
- CMD:unban(playerid,params[]) {
- if(IsPlayerAdmin(playerid)) {
- if(isnull(params)) return SendClientMessage(playerid,0xDC143CAA,"Usage: /unban [playername]");
- new Query[250];
- format(Query, sizeof(Query), "SELECT * FROM banneds WHERE `name` = '%s'", params);
- mysql_tquery(mysql, Query, "Unban", "i", playerid);
- } else return SendClientMessage(playerid,0xDC143CAA,"ERROR: You are not a high enough level to use this command");
- return 1;
- }
- CMD:banlist(playerid,params[]) {
- if(IsPlayerAdmin(playerid)) {
- new string[200];
- format(string,sizeof(string),"{33FF33}Total {FF0000}Banned {33FF33}Players: %d\n{33FF33}Total {FF0000}Banned {33FF33}Ips: %d\nType Name in below form to check ban Information",totalbans,totalip);
- ShowPlayerDialog(playerid, 2648, DIALOG_STYLE_INPUT, "{FF0000}Banned {33FF33}Players List", string, "Search", "Close");
- } else return SendClientMessage(playerid,0xDC143CAA,"ERROR: You are not a high enough level to use this command");
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
- if(dialogid == 2648) {
- if(response == 1) {
- new string[200];
- format(string,sizeof(string),"{33FF33}Total {FF0000}Banned {33FF33}Players: %d\n{33FF33}Total {FF0000}Banned {33FF33}Ips: %d\nType Name in below form to check ban Information",totalbans,totalip);
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 2648, DIALOG_STYLE_INPUT, "{FF0000}Banned {33FF33}Players List", string, "Search", "Close");
- new Query[128];
- format(Query, sizeof(Query), "SELECT * FROM banneds WHERE `name` = '%s'", inputtext);
- mysql_tquery(mysql, Query, "DBaninfo", "i", playerid);
- } if(response == 0) {
- SendClientMessage(playerid,0xFF0000AA,"Ban BOT: {33FF33}You have Closed Dialog Ban List");
- }
- }
- return 0;
- }
- CMD:unbanip(playerid,params[]) {
- if(IsPlayerAdmin(playerid)) {
- if(isnull(params)) return SendClientMessage(playerid,0xDC143CAA,"Usage: /unbanip [ip]");
- new size; size = strval(params);
- if(size > 10 && size < 30) {
- new Query[250];
- format(Query, sizeof(Query), "SELECT * FROM bannedips WHERE `ip` = '%s'", params);
- strins(whatunbanip, params, 0);
- mysql_tquery(mysql, Query, "Unbanip", "i", playerid);
- } else return SendClientMessage(playerid,0xDC143CAA,"ERROR: IP is too short or is too long");
- } else return SendClientMessage(playerid,0xDC143CAA,"ERROR: You are not a high enough level to use this command");
- return 1;
- }
- CMD:banip(playerid,params[]) {
- if(IsPlayerAdmin(playerid)) {
- if(isnull(params)) return SendClientMessage(playerid,0xDC143CAA,"Usage: /banip [ip]");
- new size; size = strval(params);
- if(size > 10 && size < 30) {
- new Query[250];
- format(Query, sizeof(Query), "SELECT * FROM bannedips WHERE `ip` = '%s'", params);
- mysql_tquery(mysql, Query, "Banip", "i", playerid); offlineb[playerid] = 0;
- strins(whatbanip, params, 0);
- } else return SendClientMessage(playerid,0xDC143CAA,"ERROR: IP is too short or is too long");
- } else return SendClientMessage(playerid,0xDC143CAA,"ERROR: You are not a high enough level to use this command");
- return 1;
- }
- public Banip(playerid) {
- new rows, fields,string[128],Query[250];
- cache_get_data(rows, fields, mysql);
- if(rows)
- {
- if(offlineb[playerid] == 0) SendClientMessage(playerid,0xDC143CAA,"ERROR: That ip already banned");
- return whatbanip = "";
- }
- if(!rows)
- {
- format(Query, sizeof(Query),"INSERT INTO `bannedips`(`ip`) VALUES ('%s')",whatbanip);
- mysql_tquery(mysql, Query, "", ""); totalip ++;
- if(offlineb[playerid] == 0) {
- format(string,sizeof(string),"[IP]: %s has been successfully banned",whatbanip);
- SendClientMessage(playerid,0x00FFFFAA,string); }
- whatbanip = "";
- }
- return 1;
- }
- CMD:baninfo(playerid,params[]) {
- if(IsPlayerAdmin(playerid)) {
- if(isnull(params)) return SendClientMessage(playerid,0xDC143CAA,"Usage: /baninfo [playername]");
- new Query[250];
- format(Query, sizeof(Query), "SELECT * FROM banneds WHERE `name` = '%s'", params);
- mysql_tquery(mysql, Query, "Baninfo", "i", playerid);
- } else return SendClientMessage(playerid,0xDC143CAA,"ERROR: You are not a high enough level to use this command");
- return 1;
- }
- //================================Publics=====================================//
- public BanCheck(playerid) {
- new rows, fields,ibanned[10][2],ifbanned[2],save[5][80],checkdate[2];
- cache_get_data(rows, fields, mysql);
- if(rows)
- {
- 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","");
- 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) {
- cache_get_field_content(0, "bdate", save[0], mysql, 80);
- new Year,Month,Day,string[128],ip[50]; getdate(Year, Month, Day);
- format(string,sizeof string,"%d-%d-%d",Year,Month,Day);
- strins(checkdate[1], string, 0);
- strins(checkdate[0], save[0], 0);
- if(checkdate[0] - checkdate[1] <= 0-0-0) {
- new Query[250]; GetPlayerIp(playerid,ip,sizeof ip);
- 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'",ip);
- mysql_tquery(mysql, Query, "", "");
- return SendClientMessage(playerid, 0x33FF33AA,"Ban BOT: |- Your Ban Has been Expired -|");
- }
- new saves[3][128],by[128],expire[128];
- 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);
- cache_get_field_content(0, "bdate", expire, mysql, 128);
- new str[350],content[128]; format(content,sizeof content,"%s %s",saves[0],saves[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{00FFFF}Ban Expire Date: {33FF33}%s\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","");
- SetTimerEx("kickplayer", 500, false, "i", playerid);
- }
- }
- }
- if(!rows)
- {
- new Query[250],ip1[32]; GetPlayerIp(playerid,ip1,sizeof(ip1));
- format(Query, sizeof(Query), "SELECT * FROM `bannedips` WHERE `ip` = '%s'", ip1);
- mysql_tquery(mysql, Query, "BanIPCheck", "i", playerid);
- }
- return 1;
- }
- public BanIPCheck(playerid) {
- new rows, fields,string[128];
- cache_get_data(rows, fields, mysql);
- if(rows)
- {
- format(string,sizeof(string),"%s has been Auto Kicked | Reason: Banned IP |",pName(playerid));
- SendClientMessageToAll(COLOR_Silver,string);
- SetTimerEx("kickplayer", 500, false, "i", playerid);
- }
- if(!rows)
- {
- new Query[250],datum[50],hour1,minute1,second1,year1,month1,day1,tijd[50],ip1[32];
- getdate(year1, month1, day1); gettime(hour1,minute1,second1); GetPlayerIp(playerid,ip1,sizeof(ip1));
- format(datum, sizeof(datum), "%d-%d-%d", year1, month1, day1); format(tijd, sizeof(tijd), "%d:%d:%d", hour1, minute1, second1);
- new none[15]; none = "None";
- format(Query, sizeof(Query),"INSERT INTO `banneds` (name,ip,date,time,bannedby,banned,reason,bdate,tempban) VALUES ('%s','%s','%s','%s','%s','%d','%s','%s','%d')",pName(playerid),ip1,datum,tijd,none,0,none,none,0);
- mysql_tquery(mysql, Query, "", "");
- }
- }
- public Unban(playerid) {
- new rows, fields,string[128];
- cache_get_data(rows, fields, mysql);
- if(rows)
- {
- new Query[250],saving0[10],saving1[32],saving2[32],unban;
- cache_get_field_content(0, "name", saving2, mysql, 32);
- cache_get_field_content(0, "banned", saving0, mysql, 10);
- cache_get_field_content(0, "ip", saving1, mysql, 32);
- unban = strval(saving0);
- if(unban == 1) {
- new none[10]; none = "0";
- format(Query, sizeof(Query),"UPDATE `banneds` SET `banned` = 0,`banned` = 0,`tempban` = %s,`reason` = %s WHERE `name` = '%s'",none,none,saving2);
- mysql_tquery(mysql, Query, "", "");
- format(Query, 100, "DELETE FROM `bannedips` WHERE `ip` = '%s'", saving1);
- mysql_tquery(mysql, Query, "", ""); totalbans --; totalip --;
- format(string,sizeof(string),"%s successfully has been unbanned",saving2);
- SendClientMessage(playerid,0x00FFFFAA,string);
- } 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;
- }
- CMD:oban(playerid,params[]) {
- if(IsPlayerAdmin(playerid)) {
- new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
- if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid,0xDC143CAA," Usage /oban [playername] [reason]");
- new Query[250];
- format(Query, sizeof(Query), "SELECT * FROM banneds WHERE `name` = '%s'", tmp);
- strins(banreason, tmp2, 0);
- return mysql_tquery(mysql, Query, "offlineban", "i", playerid);
- } else return SendClientMessage(playerid,0xDC143CAA,"ERROR: You need to be rcon to use this command");
- }
- public offlineban(playerid) {
- new rows, fields,string[128];
- cache_get_data(rows, fields, mysql);
- if(rows)
- {
- new Query[250],saving[3][128],banned1;
- cache_get_field_content(0, "name", saving[0], mysql, 128);
- cache_get_field_content(0, "banned", saving[1], mysql, 32);
- cache_get_field_content(0, "ip", saving[2], mysql, 32);
- banned1 = strval(saving[1]);
- if(banned1 == 0) {
- format(Query, sizeof(Query),"UPDATE `banneds` SET `banned` = 1, `bannedby` = '%s' ,`reason` = '%s' WHERE `name` = '%s'",pName(playerid),banreason,saving[0]);
- mysql_tquery(mysql, Query, "", ""); offlineb[playerid] = 1; banreason = "";
- strins(whatbanip, saving[2], 0); totalbans ++; printf("%s",Query);
- format(Query, sizeof(Query), "SELECT * FROM bannedips WHERE `ip` = '%s'", saving[2]);
- mysql_tquery(mysql, Query, "Banip", "i", playerid);
- format(string,sizeof(string),"%s, has been successfully banned",saving[0]);
- SendClientMessage(playerid,0x00FFFFAA,string);
- } else { banreason = ""; return SendClientMessage(playerid,0xDC143CAA,"ERROR: This Player is already banned");}
- } else {banreason = ""; return SendClientMessage(playerid,0xDC143CAA,"ERROR: Player Name Not Exist on Database");}
- return 1;
- }
- public Unbanip(playerid) {
- new rows, fields,string[128];
- cache_get_data(rows, fields, mysql);
- if(rows)
- {
- new Query[250];
- format(Query, 100, "DELETE FROM `bannedips` WHERE `ip` = '%s'", whatunbanip);
- mysql_tquery(mysql, Query, "", ""); totalip --;
- format(string,sizeof(string),"[IP]: %s has been successfully unbanned", whatunbanip);
- SendClientMessage(playerid,0x00FFFFAA,string);
- whatunbanip = "";
- } else return SendClientMessage(playerid,0xDC143CAA,"ERROR: IP Not Exist on banned ips Database"); whatunbanip = "";
- 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\n{00FFFF}Banned By: {33FF33}%s\n\n{00FFFF}Date: {33FF33}%s\n\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[128];
- 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);
- cache_get_field_content(0, "bdate", expire, mysql, 128);
- new content[128]; format(content,sizeof content,"%s %s",saves[0],saves[1]);
- format(str2,sizeof(str2),"%s Ban Information",save[4]);
- format(str, sizeof(str),"{00FFFF}Player Name: {33FF33}%s\n\n{00FFFF}Banned By: {33FF33}%s\n{00FFFF}Date: {33FF33}%s\n{00FFFF}Reason: {33FF33}%s\n{00FFFF}Ban Expire Date: {33FF33}%s\n{C0C0C0}* if you think that you're banned wrongfully,\nfeel free to make unban appeal on our forum: forum"\
- ,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\n{00FFFF}Banned By: {33FF33}%s\n\n{00FFFF}Date: {33FF33}%s\n\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[128];
- 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);
- cache_get_field_content(0, "bdate", expire, mysql, 128);
- new content[128]; format(content,sizeof content,"%s %s",saves[0],saves[1]);
- format(str2,sizeof(str2),"%s Ban Information",save[4]);
- format(str, sizeof(str),"{00FFFF}Player Name: {33FF33}%s\n\n{00FFFF}Banned By: {33FF33}%s\n{00FFFF}Date: {33FF33}%s\n{00FFFF}Reason: {33FF33}%s\n{00FFFF}Ban Expire Date: {33FF33}%s\n{C0C0C0}* if you think that you're banned wrongfully,\nfeel free to make unban appeal on our forum: forum"\
- ,save[4],by,content,saves[2],expire);
- ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, str2, str, "Close","");
- } else return ShowPlayerDialog(playerid, 2648, DIALOG_STYLE_INPUT, "{FF0000}Banned {33FF33}Players List", "Player Name you Entered Are not banned", "Search", "Close");
- }
- } else return ShowPlayerDialog(playerid, 2648, DIALOG_STYLE_INPUT, "{FF0000}Banned {33FF33}Players List", "Player Name not Exist on database", "Search", "Close");
- return 1;
- }
- public kickplayer(playerid) {
- return Kick(playerid);
- }
- //==================================a fuction=================================//
- strtok(const string[], &index)
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' '))
- {
- index++;
- }
- new offset = index;
- new result[20];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
- pName(playerid) {
- new pname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pname, sizeof(pname));
- return pname;
- }
- //============================================================================//
Add Comment
Please, Sign In to add comment