Quote:
Originally Posted by Bugsy
Oh, I'm sorry, I didnt realize you had the variable/cvar to control the day it restarts.
|
Correct me if I'm wrong ..
PHP Code:
bind_pcvar_num(create_cvar("tf_day_reset", "0", .description = "On the selected day of each month the rank will be reset.", .has_min = true, .min_val = 0.0, .has_max = true, .max_val = 31.0), VarTimeToReset) // Here we set the day of the monthly reset and save the value in pcvar "VarTimeToReset"
set_task_ex(86400.0, "CheckDate", .flags = SetTask_Repeat) // Here we configure the task that verifies the day, but it will be changed to a much lower value, I believe that 10 minutes is totally acceptable.
public CheckDate()
{
new Day
date(.day = Day)
if(Day == VarTimeToReset)
{
server_cmd("amx_cvar csstats_reset 1")
client_print_color(0, print_team_red, "^x04[TopFlags]^x03: Today is day^x04 %d^x01 and the ranking will be^x04 reseted^x01, at the next map exchange, run to guarantee the^x04 TOP.", Day)
set_task_ex(3.0, "ChangeLevel", .flags = SetTask_Once)
}
} // Finally we check the day, if the Day, is equal to pcvar (day chosen for the reset) the statistics will be reset and the map will be reloaded.
Edit: Okay, parsing the plugin that was not you who wrote is not fun and easy haha, I did not understand this part well, could you give me an example?
Quote:
Originally Posted by Bugsy
In plugin_init(), check the vault for a date record, if it does not exist or is expired, reset sets and write the current date. This would make the check occur on each map change while allowing it to only reset stats on the desired day of the month.
|
__________________