[Ajuda]Temp Ban -
keller012 - 17.11.2010
Eu peguei um temp ban aqui no forum
So que ele nao ta funcionando direito.
Ele bani certinho so que na hora de desbanir ele nao faz...
as 2 principais partes tao ai
se alguem pude ajuda eu ficaria grato
pawn Код:
if(strcmp(cmd, "/tempban", true) == 0)
{
if (IsPlayerAdmin(playerid))
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ORANGE, "USAGE: /tempban [playerid] [day] [reason]");
SendClientMessage(playerid, ORANGE, "FUNCTION: Temporarily bans a player. You must enter the month, day and hour numbers. You set them, not add.");
return 1;
}
giveplayerid = ReturnUser(tmp);
new string[128];
if(IsPlayerConnected(giveplayerid))
{
tmp = strtok(cmdtext, idx);
if (!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /tempban [playerid] [day] [reason]");
new days = strval(tmp);
new reason[128];
reason = bigstr(cmdtext, idx);
if (!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /tempban [playerid] [day] [REASON]");
new ip[15];
GetPlayerIp(giveplayerid,ip,15);
GetPlayerName(playerid, name, sizeof name);
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
new File:tempban = fopen("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(ADMIN_RED,string);
Kick(giveplayerid);
}
else
{
format(string, sizeof(string), "%d is not an active player.", giveplayerid);
SendClientMessage(playerid, RED, string);
}
}
else return SendClientMessage(playerid, RED, "You are not an admin.");
return true;
}
pawn Код:
stock TempBanCheck(playerid)
{
new ip[15];
new str[128];
new load[4][32];
new ban_day, ban_month, ban_year, ban_ip[15];
GetPlayerIp(playerid, ip, sizeof ip);
new year, month, day;
getdate(year, month, day);
new File:file = fopen("TempBans.ban",io_read);
if (file)
{
while (fread(file, str, sizeof str))
{
split(str, load, '|');
ban_day = strval(load[0]);
ban_month = strval(load[1]);
ban_year = strval(load[2]);
strmid(ban_ip, load[3], 0, strlen(load[3])-1, 15);
if (!(year >= ban_year && month >= ban_month && day >= ban_day && !strcmp(ban_ip, ip, true)))
{
format(str, sizeof str, "|- You are temporarily banned from this server until: %d/%d/%d -|", ban_day, ban_month, ban_year);
SendClientMessage(playerid, ADMIN_RED, str);
return Kick(playerid);
}
}
}
return true;
}
Respuesta: [Ajuda]Temp Ban -
ipsBruno - 18.11.2010
Cara este Sistema de Temp-Ban estб mal otimizado e nгo mais atualizado.
CJ Temp Ban System,й bom
Re: [Ajuda]Temp Ban -
keller012 - 18.11.2010
tem aqui no forum ele drakins??
eu procurei pelo q tu mando mans nao achei nada
so um temp ban sem link nem code