You're right about get_systime that's better than set_task.
I wonder what is better to use, get_gametime or get_systime... (except the fact that one is Float).
But considering that mp_roundtime can be changed by an admin after the begining of a round, i think it's better to use a global and to set it each begining of round.
I think that this should do the trick :
Code:
#include <amxmodx>
new started_time ,rt
new roundtime
public plugin_init() {
register_plugin("NAME","VERSION","AUTHOR")
register_logevent("eRoundStart", 2, "1=Round_Start")
roundtime = get_cvar_pointer("mp_roundtime")
register_clcmd("test","testCmd")
}
public eRoundStart() {
started_time = get_systime()
rt = floatround(floatmul(get_pcvar_float(roundtime), 60.0)) - 1
}
get_remaining_seconds() {
new seconds_left = rt - (get_systime() - started_time)
return seconds_left
}
public testCmd(id) {
client_print(id, print_chat, "%i seconds remaining", get_remaining_seconds())
return PLUGIN_HANDLED
}