mirror of
				https://github.com/ErikasKontenis/SabrehavenServer.git
				synced 2025-10-31 03:56:22 +01:00 
			
		
		
		
	close server onstartup and increase premium reward on same day login
This commit is contained in:
		| @@ -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())) | 		loginStr = string.format("Your last visit on " .. configManager.getString(configKeys.SERVER_NAME) .. ": %s.", os.date("%a %b %d %X %Y", player:getLastLoginSaved())) | ||||||
| 	end | 	end | ||||||
| 	 | 	 | ||||||
| 	local dayNow = tonumber(os.date("%d", os.time())) | 	if not player:isPremium() then | ||||||
| 	local hourNow = tonumber(os.date("%H", os.time())) | 		local dayNow = tonumber(os.date("%d", os.time())) | ||||||
| 	if dayNow == 8 and hourNow <= 20 then | 		local hourNow = tonumber(os.date("%H", os.time())) | ||||||
| 		if player:getPremiumDays() == 0 then | 		if dayNow == 8 and hourNow == 20 then | ||||||
| 			player:addPremiumDays(5) | 			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!") | 			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 | ||||||
| 	end | 	end | ||||||
| 	 | 	 | ||||||
| @@ -33,6 +36,8 @@ function onLogin(player) | |||||||
| 	-- Premium system | 	-- Premium system | ||||||
| 	if player:isPremium() then | 	if player:isPremium() then | ||||||
| 		player:setStorageValue(43434, 1) | 		player:setStorageValue(43434, 1) | ||||||
|  | 	elseif player:getStorageValue(43434) == 1 then | ||||||
|  | 		player:setStorageValue(43434, 0) | ||||||
| 	end | 	end | ||||||
| 	 | 	 | ||||||
| 	-- Events | 	-- Events | ||||||
|   | |||||||
| @@ -196,6 +196,7 @@ function onStartup() | |||||||
| 	end | 	end | ||||||
| 	 | 	 | ||||||
| 	spawnRashid() | 	spawnRashid() | ||||||
|  | 	addEvent(function () Game.setGameState(GAME_STATE_CLOSED) end, 5000) | ||||||
| 	setGlobalStorageValue(17657, 0) -- reset POI levers | 	setGlobalStorageValue(17657, 0) -- reset POI levers | ||||||
| 	setGlobalStorageValue(8420, monsterOfTheDay[math.random(1, #monsterOfTheDay)].id) | 	setGlobalStorageValue(8420, monsterOfTheDay[math.random(1, #monsterOfTheDay)].id) | ||||||
| 	setGlobalStorageValue(8421, math.random(10, 25)) | 	setGlobalStorageValue(8421, math.random(10, 25)) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 ErikasKontenis
					ErikasKontenis