Hey,
I have a small problem with powergamers statistics. Statistics work properly and reset every 24 hours (at 0:00). The problem is that every time the server restarts, the statistics skip for one day. Does anyone know what to do to make the statistics reset and jump one day in the table only after the day's end? (and resetting the server should not affect the change in statistics?) i got tfs 1.2
globalevents.xml
history.lua
I have a small problem with powergamers statistics. Statistics work properly and reset every 24 hours (at 0:00). The problem is that every time the server restarts, the statistics skip for one day. Does anyone know what to do to make the statistics reset and jump one day in the table only after the day's end? (and resetting the server should not affect the change in statistics?) i got tfs 1.2
globalevents.xml
XML:
<globalevent name="history" interval="60" script="history.lua"/>
history.lua
Lua:
function onThink(interval, lastExecution)
if (tonumber(os.date("%d")) ~= getGlobalStorageValue(23456)) then
setGlobalStorageValue(23456, (tonumber(os.date("%d"))))
db.query("UPDATE `players` SET `exphist7`=players.exphist6, `exphist6`=players.exphist5, `exphist5`=players.exphist4, `exphist4`=players.exphist3, `exphist3`=players.exphist2, `exphist2`=players.exphist1, `exphist1`=players.experience-players.exphist_lastexp, `exphist_lastexp`=players.experience;")
end
return TRUE
end