03.09.2010, 23:07
I am trying to make a tempban script, but the check doesn't work, what is the problem?
pawn Код:
stock CheckTempBan(playerid)
{
new ip[15];
new str[128];
new load[3][32];
new ban_second, ban_minute, ban_hour, ban_ip[20];
GetPlayerIp(playerid, ip, sizeof ip);
new hour, minute, second;
gettime(hour, minute);
new File:file = fopen("/userfiles/tempban.ini",io_read);
if (file)
{
while (fread(file, str, sizeof str))
{
split(str, load, '|');
ban_hour = strval(load[0]);
ban_minute = strval(load[1]);
strmid(ban_ip, load[2], 0, strlen(load[2])-1, 15);
if (!(hour >= ban_hour && minute >= ban_minute) && !strcmp(ban_ip, ip, true))
{
format(str, sizeof str, "You are temporarily banned from this server until: %d:%d", ban_hour, ban_minute);
SendClientMessage(playerid, COLOR_CYAN, str);
return Kick(playerid);
}
}
}
return true;
}