Ir para conteúdo

[MOD]Good Time bug in start event.


michal16202

Posts Recomendados

Hello, I have a problem with [MOD]Good Time Event. I use TFS 0.3.6, i set which days of the week and time to enable/disable event, and it not working. I tried change loading date and time from the array, and again not working.

 

I tried change this:

 local daysOpen = {}
           
            for k, v in pairs(newWC.days) do
                table.insert(daysOpen, k)
            end
           
            function onThink(cid, interval)
                print(os.date('%A'))
                if isInArray(daysOpen, os.date('%A')) then
                    for _, d in pairs(newWC.days[os.date('%A')]) do
                        if isInArray(d.from, os.date('%X', os.time())) then
                            if getStorage(newWC.event) ~= 1 then
                                local newRate = newWC.rates[math.random(#newWC.rates)]
   
                                for _, cid in ipairs(getPlayersOnline()) do
                                    doPlayerSetSkills(cid, newRate)
                                    doCreatureSetStorage(cid, newWC.checkEvent, 1)
                                end

                                doSetStorage(newWC.event, 1)
                                doSetStorage(newWC.rateStorage, newRate)

                                                                       
                                for i = 1, newWC.howMuchTimesPoints do
                                    addEvent(randPoints, i * newWC.everyMinPoints * 60 * 1000, newWC.points)
                                end
                                                   
                                doBroadcastMessage('Happy Hours! Rates have changed to: ' .. newRate .. '! Rates will back to normal in ' .. d.to .. ' (server time). Have fun!!', MESSAGE_STATUS_WARNING)
                            end
                        break
                        end
                    end
                end
 

To this:

function onThink(interval)
print(os.date('%A'))
local checkCorrectDay = newWC.days[os.date('%A'):lower()]
if not checkCorrectDay then
    return true
end
print(1)
for k, v in pairs(checkCorrectDay) do
    if isInArray(v.to, os.date('%X', os.time())) then
print(2)
        if getStorage(newWC.event) ~= -1 then
                local newRate = newWC.rates[math.random(#newWC.rates)]
   
                                for _, cid in ipairs(getPlayersOnline()) do
                                    doPlayerSetSkills(cid, newRate)
                                    doCreatureSetStorage(cid, newWC.checkEvent, 1)
                                end

                                doSetStorage(newWC.event, 1)
                                doSetStorage(newWC.rateStorage, newRate)

                                                                       
                                for i = 1, newWC.howMuchTimesPoints do
                                    addEvent(randPoints, i * newWC.everyMinPoints * 60 * 1000, newWC.points)
                                end
                                                   
                                doBroadcastMessage('Happy Hours! Rates have changed to: ' .. newRate .. '! Rates will back to normal in ' .. d.to .. ' (server time). Have fun!!', MESSAGE_STATUS_WARNING)
                            end
        break
    end
end
return true
end

And agin no result clear.png
Here is the MOD:http://wklej.org/id/1337785/

 

Help me with this MOD.


Refresh, any idea how to fix it?


Refresh

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...