mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-04-29 09:09:20 +02:00
close server onstartup and increase premium reward on same day login
This commit is contained in:
parent
1d6b914489
commit
95e0c0155a
@ -1 +1 @@
|
||||
next: 17739
|
||||
next: 17740
|
@ -11,12 +11,15 @@ function onLogin(player)
|
||||
loginStr = string.format("Your last visit on " .. configManager.getString(configKeys.SERVER_NAME) .. ": %s.", os.date("%a %b %d %X %Y", player:getLastLoginSaved()))
|
||||
end
|
||||
|
||||
local dayNow = tonumber(os.date("%d", os.time()))
|
||||
local hourNow = tonumber(os.date("%H", os.time()))
|
||||
if dayNow == 8 and hourNow <= 20 then
|
||||
if player:getPremiumDays() == 0 then
|
||||
if not player:isPremium() then
|
||||
local dayNow = tonumber(os.date("%d", os.time()))
|
||||
local hourNow = tonumber(os.date("%H", os.time()))
|
||||
if dayNow == 8 and hourNow == 20 then
|
||||
player:addPremiumDays(5)
|
||||
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Congratulations " .. player:getName() .. " on starting your adventure at the " .. configManager.getString(configKeys.SERVER_NAME) .. "! 5 premium days have been added to your account!")
|
||||
elseif dayNow == 8 then
|
||||
player:addPremiumDays(2)
|
||||
player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Congratulations " .. player:getName() .. " on starting your adventure at the " .. configManager.getString(configKeys.SERVER_NAME) .. "! 2 premium days have been added to your account!")
|
||||
end
|
||||
end
|
||||
|
||||
@ -33,6 +36,8 @@ function onLogin(player)
|
||||
-- Premium system
|
||||
if player:isPremium() then
|
||||
player:setStorageValue(43434, 1)
|
||||
elseif player:getStorageValue(43434) == 1 then
|
||||
player:setStorageValue(43434, 0)
|
||||
end
|
||||
|
||||
-- Events
|
||||
|
@ -196,6 +196,7 @@ function onStartup()
|
||||
end
|
||||
|
||||
spawnRashid()
|
||||
addEvent(function () Game.setGameState(GAME_STATE_CLOSED) end, 5000)
|
||||
setGlobalStorageValue(17657, 0) -- reset POI levers
|
||||
setGlobalStorageValue(8420, monsterOfTheDay[math.random(1, #monsterOfTheDay)].id)
|
||||
setGlobalStorageValue(8421, math.random(10, 25))
|
||||
|
Loading…
x
Reference in New Issue
Block a user