Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- }
- CMD:banday(playerid, params[])
- {
- new name[MAX_PLAYER_NAME];
- if(PlayerInfo[playerid][pAdmin] >= 3)
- {
- new giveplayerid,days,reason[128],string[128],giveplayer[25];
- if(sscanf(params, "uds[128]", giveplayerid,days,reason)) return SCM(playerid,COLOR_WHITE,"{B8DBFF}Syntax: /banday <Name/Playerid> <day> <Reason>");
- if(IsPlayerConnected(giveplayerid))
- {
- if(days <= 0 || days > 1000) return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Invalid Day! (1-1000)");
- GetPlayerName(playerid, name, sizeof name);
- GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
- new year,month,day;
- getdate(year, month, day);
- day += days;
- 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;
- }
- }
- PlayerInfo[giveplayerid][pBTemp] = 1;
- PlayerInfo[giveplayerid][pBYear] = year;
- PlayerInfo[giveplayerid][pBMonth] = month;
- PlayerInfo[giveplayerid][pBDay] = day;
- strmid(PlayerInfo[giveplayerid][pBBy], name, 0, strlen(name), 255);
- strmid(PlayerInfo[giveplayerid][pBReason], reason, 0, strlen(reason), 255);
- Update(giveplayerid,pBTempx);
- Update(giveplayerid,pBYearx);
- Update(giveplayerid,pBMonthx);
- Update(giveplayerid,pBDayx);
- Update(giveplayerid,pBByx);
- Update(giveplayerid,pBReasonx);
- if(days == 1)
- {
- format(string,128,"AdmCmd: %s was banned by %s for %d day, reason: %s",giveplayer,name,days,reason);
- SendClientMessageToAll(COLOR_LIGHTRED,string);
- }
- else if(days > 1)
- {
- format(string,128,"AdmCmd: %s was banned by %s for %d days, reason: %s",giveplayer,name,days,reason);
- SendClientMessageToAll(COLOR_LIGHTRED,string);
- }
- new ip[25];
- GetPlayerIp(giveplayerid, ip, sizeof(ip));
- Banlog(ip,PlayerInfo[giveplayerid][pSQLID],PlayerInfo[playerid][pSQLID],reason,days);
- KickEx(giveplayerid);
- }
- else return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Atentie: Acest player nu e conectat.");
- }
- else return SendClientMessage(playerid,COLOR_WHITE,AdminOnly);
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement