Lopaskurwa
Active Member
- Joined
- Oct 6, 2017
- Messages
- 873
- Solutions
- 2
- Reaction score
- 49
Hi im using os.date function so particular global storage would activate on described date, but noticed that it ignores the days i defined and it activated all the time and global interval i set up is 1 hour
Lua:
local days = {"Saturday", "Sunday"}
function onThink(interval)
local state = Game.getGameState()
if state == GAME_STATE_CLOSED or state == GAME_STATE_CLOSING then
return true
end
local storage = getGlobalStorageValue(Storage.Weekend)
if storage >= 1 and not table.contains(days, os.date("%A")) then
setGlobalStorageValue(Storage.Weekend, 0)
broadcastMessage("disabled!", MESSAGE_STATUS_WARNING)
return true
end
if storage < 1 then
setGlobalStorageValue(Storage.Weekend, 1)
broadcastMessage("activated!", MESSAGE_STATUS_WARNING)
end
return true
end