"mapchooser" plugin sets a task every 15 seconds and checks for possible win conditions:
Code:
public voteNextmap()
{
new winlimit = get_cvar_num("mp_winlimit") // plugin is old, you use pointers !
new maxrounds = get_cvar_num("mp_maxrounds")
if (winlimit) // this one checks if a team is nearing mp_winlimit
{
new c = winlimit - 2
if ((c > g_teamScore[0]) && (c > g_teamScore[1]))
{
g_selected = false
return
}
}
else if (maxrounds) // this one checks if the round is nearing mp_maxrounds
{
if ((maxrounds - 2) > (g_teamScore[0] + g_teamScore[1]))
{
g_selected = false
return
}
} else { // and this one checks if it's near the time limit
new timeleft = get_timeleft()
if (timeleft < 1 || timeleft > 129)
{
g_selected = false
return
}
}
//...
}
Still, set_task() has a flag, "d - do task on time before a map timeleft", but I never tested it and I dunno what effect the time has on it... it may be negative, like, if you specify 30.0 and flag "d" it *could* trigger 30 seconds before timelimit... or you could try -30.0... just experiment with that since it would be a far better method than checking each X seconds.
__________________