Terotrificy
Veteran OT User
Hello, i have my site working 100%. But i can't make the startup handle it.
I took this script from TFS 1.0, but receiving this error:
Server Console on startup:
Here is the code:
Startup.lua:
Anyone who can help to make it work in Othire?
I took this script from TFS 1.0, but receiving this error:
Server Console on startup:
Lua:
Lua Script Error: [GlobalEvent Interface]
data/globalevents/scripts/startup.lua:onStartup
data/globalevents/scripts/startup.lua:9: attempt to call global 'House' (a table value)
stack traceback:
data/globalevents/scripts/startup.lua:9: in function <data/globalevents/scripts/startup.lua:1>
Here is the code:
Startup.lua:
Code:
-- Check house auctions
local resultId = db.storeQuery("SELECT `id`, `highest_bidder`, `last_bid`, (SELECT `balance` FROM `players` WHERE `players`.`id` = `highest_bidder`) AS `balance` FROM `houses` WHERE `owner` = 0 AND `bid_end` != 0 AND `bid_end` < " .. os.time())
if resultId ~= false then
repeat
local house = House(result.getDataInt(resultId, "id"))
if house ~= nil then
local highestBidder = result.getDataInt(resultId, "highest_bidder")local balance = result.getDataLong(resultId, "balance")local lastBid = result.getDataInt(resultId, "last_bid")
if balance >= lastBid then
db.query("UPDATE `players` SET `balance` = " .. (balance - lastBid) .. " WHERE `id` = " .. highestBidder)
house:setOwnerGuid(highestBidder)
end
-- here new code:
db.query("UPDATE `houses` SET `last_bid` = 0, `bid_end` = 0, `highest_bidder` = 0, `bid` = 0 WHERE `id` = " .. house:getId())
end
until not result.next(resultId)
result.free(resultId)
end
Anyone who can help to make it work in Othire?