• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Bid System for Othire 1.0

Terotrificy

Veteran OT User
Joined
Oct 18, 2020
Messages
401
Solutions
13
Reaction score
254
Location
Santiago, Chile.
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:
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?
 
Back
Top