Jump to content
  • 0

[Resolvido] Script ser executado assim que ligar o server


Kheus Andrade

Question

6 answers to this question

Recommended Posts

  • 0

Tenho esse script aqui de exemplo.

 

local function doCheckHouses()

	local dias = 10
	local tempo = os.time() - (dias * 24 * 60 * 60)
	local registros = db.storeQuery("SELECT `houses`.`owner`, `houses`.`id` FROM `houses`,`players` WHERE `houses`.`owner` != 0 AND `houses`.`owner` = `players`.`id` AND `players`.`lastlogin` <= " .. tempo .. ";")
	
	if registros ~= false then
	
		local count = 0
		
		print('House leave code')
		
		repeat
			count = count + 1
			
			local owner = result.getNumber(registros, "owner")
			local houseId = result.getNumber(registros, "id")
			local house = House(houseId)
			
			if house and (owner > 0) then
				print(house:getName())
				house:setOwnerGuid(0)
			end
			
		until not result.next(registros)
		
		print('House leave count:' .. count)
		
		result.free(registros)
	end
end

function onStartup()
	addEvent(doCheckHouses, 60 * 1000)
	
	return true
end

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...