14.01.2015, 20:17
You'll need another command processor though, In here I used zcmd
pawn Код:
CMD:tempban(playerid, params[]) //Credits to LuxAdmin
{
if(Account[playerid][Level] < 5) return SendClientMessage(playerid,Red,"ERROR: You are not a high enough level to use this command");
new giveplayerid, days, reason[50];
if(sscanf(params, "uds[50]", giveplayerid, days, reason)) return SendClientMesage SendClientMessage(playerid,COLOR_ERROR, "{6EF83C}Usage: {FFFFFF}/tempban [PlayerID] [Day(s)] [Reason]");
if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid,Red,"ERROR: Player is not connected");
if(days <= 0 || days > 1000) return SendClientMessage(playerid, Red, "ERROR: Invalid Day! (1-1000)");
new name[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME],
new ip[15];
GetPlayerIp(giveplayerid,ip,15);
GetPlayerName(playerid, name, sizeof name);
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
new File:tempban = fopen("ZeroAdmin/Logs/TempBans.ban", io_append);
if (tempban)
{
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;
}
}
format(string, sizeof string, "%d|%d|%d|%s\n", day, month, year, ip);
fwrite(tempban, string);
fclose(tempban);
}
format(string,128,"Administrator %s Temporarily Banned %s for %d Day(s) Reason: %s",name,giveplayer,days,reason);
SendClientMessageToAll(Red,string);
Kick(giveplayerid);
format(string, sizeof string, "Admin %s Temporarily Banned %s for %d Day(s) Reason: %s",name,giveplayer,days,reason);
SaveLogs("TempBansLog",string);
return 1;
}