Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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