Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- YCMD:ban(playerid, params[], help) {
- if(PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid, COLOR_WHITE, AdminOnly);
- new id,reason[128],string[200],type, str[128];
- if(DeelayCommand[playerid][0] != 0) return DeelayTime(playerid, 0);
- if(sscanf(params, "uds[128]", id,type,reason)) return SCM(playerid,COLOR_GREY, "USAGE: {FFFFFF}/ban <playerid/name> <days | 0 = permanent ip ; 1 = permanent account> <reason>");
- if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SCM(playerid, COLOR_GREY, "Acel player nu este conectat.");
- if(id == playerid) return SCM(playerid, COLOR_GREY, "Nu iti poti da ban singur.");
- if(FaceReclama(reason)) return RemoveFunction(playerid, reason);
- if(PlayerInfo[id][pAdmin] == 7) return 1;
- if(PlayerInfo[id][pAdmin] > PlayerInfo[playerid][pAdmin]) return SCM(playerid, -1, "Acel player are adminul mai mare ca tine!");
- InsereazaSanctiune(id, playerid, BAN, reason);
- if(type == 1) {
- if(strfind(reason, "silent", true) != -1) {
- format(string, sizeof(string), "Silent: %s has been banned by %s, reason: %s", GetName(id), GetName(playerid), reason);
- SendAdminMessage(COLOR_LIGHTRED, string, 1);
- }
- else {
- format(string, sizeof(string), "AdmBot: %s has been banned by %s, reason: %s", GetName(id), GetName(playerid), reason);
- MesajLung2(COLOR_LIGHTRED, string);
- }
- PlayerInfo[id][pBanned] = 1;
- format(str,sizeof(str),"UPDATE users SET `Banned`='1' WHERE `ID`='%d'",PlayerInfo[id][pSQLID]);
- mysql_query(SQL,str);
- new ip[25];
- GetPlayerIp(id, ip, sizeof(ip));
- Banlog(ip,GetName(id),GetName(playerid),reason,0);
- KickEx(id);
- }
- else if(type == 0) {
- if(strfind(reason, "silent", true) != -1) {
- format(string, sizeof(string), "Silent: %s has been permanent banned by %s, reason: %s", GetName(id), GetName(playerid), reason);
- SendAdminMessage(COLOR_LIGHTRED, string, 1);
- }
- else {
- format(string, sizeof(string), "AdmBot: %s has been permanent banned by %s, reason: %s", GetName(id), GetName(playerid), reason);
- MesajLung2(COLOR_LIGHTRED, string);
- }
- PlayerInfo[id][pBanned] = 1;
- format(str,sizeof(str),"UPDATE users SET `Banned`='1' WHERE `ID`='%d'",PlayerInfo[id][pSQLID]);
- mysql_query(SQL,str);
- new ip[25];
- GetPlayerIp(id, ip, sizeof(ip));
- Banlog(ip,GetName(id),GetName(playerid),reason,0);
- BanSerial(id, playerid, reason);
- Ban(id);
- KickEx(id);
- }
- else if(type > 1) {
- if(strfind(reason, "silent", true) != -1) {
- format(string, sizeof(string), "Silent: %s a primit ban de la %s pentru %d zile, motiv: %s", GetName(id), GetName(playerid), type, reason);
- SendAdminMessage(COLOR_LIGHTRED, string, 1);
- }
- else {
- format(string, sizeof(string), "AdmBot: %s a primit ban de la %s pentru %d zile, motiv: %s", GetName(id), GetName(playerid), type, reason);
- MesajLung2(COLOR_LIGHTRED, string);
- }
- new year,month,day;
- getdate(year, month, day);
- day += type;
- if(IsMonth31(month)) {
- if(day > 31) {
- month += 1;
- if(month > 12) {
- year += 1;
- while(day > 31) day -= 31;
- }
- else while(day > 31) day -= 31;
- }
- }
- else if(!IsMonth31(month)) {
- if(day > 30) {
- month += 1;
- if(month > 12) {
- year += 1;
- while(day > 30) day -= 30;
- }
- else while(day > 30) day -= 30;
- }
- }
- else if(!IsMonth31(month) && IsMonth29(year) && month == 2) {
- if(day > 29) {
- month += 1;
- if(month > 12) {
- year += 1;
- while(day > 29) day -= 29;
- }
- else while(day > 29) day -= 29;
- }
- }
- else if(!IsMonth31(month) && !IsMonth29(year) && month == 2) {
- if(day > 28) {
- month += 1;
- if(month > 12) {
- year += 1;
- while(day > 28) day -= 28;
- }
- else while(day > 28) day -= 28;
- }
- }
- new ip[25], szQuery[256];
- GetPlayerIp(id, ip, sizeof(ip));
- Banlog(ip,GetName(id),GetName(playerid),reason,type);
- KickEx(id);
- format(szQuery, sizeof(szQuery), "UPDATE `users` SET `BTemp`='1', `BYear`='%d', `BMonth`='%d', `BDay`='%d', `BBy`='%s', `BReason`='%s' WHERE `ID`='%d'",year, month, day, GetName(playerid), reason, PlayerInfo[id][pSQLID]);
- mysql_query(SQL ,szQuery);
- }
- SCM(id,COLOR_WARNING,"Ai fost banat! Daca consideri ca ai luat ban degeaba, poti face o cerere pe (STAR-ZONE.ro/panel/unbans).");
- strmid(PlayerInfo[id][pBBy], GetName(playerid), 0, strlen(GetName(playerid)), 255);
- strmid(PlayerInfo[id][pBReason], reason, 0, strlen(reason), 255);
- Update(id,pBByx);
- Update(id,pBReasonx);
- UpdateVar2(playerid, "Bans", 1);
- PlayerInfo[playerid][pHelpedPlayers] += 2;
- PlayerInfo[playerid][pHelpedPlayersToday] += 2;
- DeelayCommand[playerid][0] = 10;
- new szQuery[256];
- format(szQuery, sizeof(szQuery), "UPDATE users SET `HelpedPlayers` = '%d', `HelpedPlayersToday`='%d' WHERE `ID` = '%d'", PlayerInfo[playerid][pHelpedPlayers], PlayerInfo[playerid][pHelpedPlayersToday], PlayerInfo[playerid][pSQLID]);
- mysql_query(SQL, szQuery);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement