public FwdThink(entity)
{
if( entity != g_unban_entity ) return;
#if defined USING_SQL
if( g_total_bans > 0 && !g_loading_bans )
#else
if( g_total_bans > 0 )
#endif
{
static _hours[5], _minutes[5], _seconds[5], _month[5], _day[5], _year[7];
format_time(_hours, sizeof(_hours) - 1, "%H");
format_time(_minutes, sizeof(_minutes) - 1, "%M");
format_time(_seconds, sizeof(_seconds) - 1, "%S");
format_time(_month, sizeof(_month) - 1, "%m");
format_time(_day, sizeof(_day) - 1, "%d");
format_time(_year, sizeof(_year) - 1, "%Y");
// c = current
// u = unban
new c_hours = str_to_num(_hours);
new c_minutes = str_to_num(_minutes);
new c_seconds = str_to_num(_seconds);
new c_month = str_to_num(_month);
new c_day = str_to_num(_day);
new c_year = str_to_num(_year);
static unban_time[32];
static u_hours, u_minutes, u_seconds, u_month, u_day, u_year;
for( new i = 0; i < g_total_bans; i++ )
{
#if MAX_BANS <= 0
static data[BannedData];
ArrayGetArray(g_array, i, data);
if( data[bd_banlength] == 0 ) continue;
#else
if( g_banlengths[i] == 0 ) continue;
#endif
#if MAX_BANS <= 0
copy(unban_time, sizeof(unban_time) - 1, data[bd_unbantime]);
#else
copy(unban_time, sizeof(unban_time) - 1, g_unbantimes[i]);
#endif
replace_all(unban_time, sizeof(unban_time) - 1, ":", " ");
replace_all(unban_time, sizeof(unban_time) - 1, "/", " ");
parse(unban_time,\
_hours, sizeof(_hours) - 1,\
_minutes, sizeof(_minutes) - 1,\
_seconds, sizeof(_seconds) - 1,\
_month, sizeof(_month) - 1,\
_day, sizeof(_day) - 1,\
_year, sizeof(_year) - 1
);
u_hours = str_to_num(_hours);
u_minutes = str_to_num(_minutes);
u_seconds = str_to_num(_seconds);
u_month = str_to_num(_month);
u_day = str_to_num(_day);
u_year = str_to_num(_year);
if( u_year < c_year
|| u_year == c_year && u_month < c_month
|| u_year == c_year && u_month == c_month && u_day < c_day
|| u_year == c_year && u_month == c_month && u_day == c_day && u_hours < c_hours
|| u_year == c_year && u_month == c_month && u_day == c_day && u_hours == c_hours && u_minutes < c_minutes
|| u_year == c_year && u_month == c_month && u_day == c_day && u_hours == c_hours && u_minutes == c_minutes && u_seconds <= c_seconds )
{
#if MAX_BANS <= 0
Log("Ban time is up for: %s [%s]", data[bd_name], data[bd_steamid]);
Print("^x04[%s]^x03 %s^x01[^x04%s^x01]^x03 Lejárt a ban!^x01 [Indok: %s]", PREFIX, data[bd_name], data[bd_steamid], data[bd_reason]);
RemoveBan(i, data[bd_steamid]);
#else
Log("Ban time is up for: %s [%s]", g_names[i], g_steamids[i]);
Print("^x04[%s]^x03 %s^x01[^x04%s^x01]^x03 lejárt a ban idő!^x01 [Indok: %s]", PREFIX, g_names[i], g_steamids[i], g_reasons[i]);
RemoveBan(i);
#endif
i--; // current pos was replaced with another ban, so we need to check it again.
}
}
}
entity_set_float(g_unban_entity, EV_FL_nextthink, get_gametime() + get_pcvar_float(ab_unbancheck));
}