[pawn]if(strcmp(cmd, \"/tempban\", true) == 0)
{
new name[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
new giveplayerid;
if(AccInfo[playerid][Level] >= 4)
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, red, \"Használat: /tempban [Játékos ID] [Nap(s)] [indok]\");
SendClientMessage(playerid, orange, \"Funkció: Evvel a Megadott Játékost Napra Pontosan ki bannolhatod\");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
tmp = strtok(cmdtext, idx);
if (!strlen(tmp))
{
SendClientMessage(playerid, red, \"Használat: /tempban [Játékos ID] [Nap(s)] [indok]\");
SendClientMessage(playerid, orange, \"Funkció: Evvel a Megadott Játékost Napra Pontosan ki bannolhatod\");
return 1;
}
new days = strval(tmp);
if(!IsNumeric(tmp))
return SendClientMessage(playerid, lightred, \"Hiba: Érvénytelen Nap! Csak Számok!\");
if(strval(tmp) <= 0 || strval(tmp) > 1000)
return SendClientMessage(playerid, lightred, \"Hiba: Érvénytelen Nap! (1-1000)\");
new reason[128];
reason = strtok2(cmdtext,idx);
if (!strlen(reason))
return SendClientMessage(playerid, lightred, \"Hiba: Ok Nincs Megadva!\");
if (strlen(reason) <= 0 || strlen(reason) > 100)
return SendClientMessage(playerid, lightred, \"Hiba: Érvénytelen Az Ok Hossza!\");
new ip[15];
GetPlayerIp(giveplayerid,ip,15);
GetPlayerName(playerid, name, sizeof name);
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
new File:tempban = fopen(\"LuxAdmin/Config/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,\"|- Adminisztrátor {057CEA}%s Bannolta %s És {CDF917}%d Nap(s) | {33FF33}Indok: %s -|\",name,giveplayer,days,reason);
SendClientMessageToAll(lightred,string);
Kick(giveplayerid);
format(string, sizeof string, \"Admin {057CEA}%s Bannolta %s És {CDF917}%d Nap(s) | {33FF33}Indok: %s\",name,giveplayer,days,reason);
SaveIn(\"TempBansLog\",string);
}
else
{
ErrorMessages(playerid, 2);
}
}
else return ErrorMessages(playerid, 1);
return true;
}[/pawn]