Hello,
I need a script that delivers houses purchased via website(znote).
the script checks 2 conditions before delivering the house(remembering that there may be more than one house to be delivered, for example 10 houses):
1. if the player has the money in the bank.
2. if the auction time is less than the current time.
Then the house is delivered (setHouseOwner) and the money in the bank is deducted, and if the player does not have the money, the purchase is undone, resetting values such as:
Preferably this script will be onStartup type, which will deliver the house as soon as the SS, being even a way to prevent the player from being online and not find a way to bug the gold in the bank (withdraw) before receiving the house.
(system similar to the global, where you buy the house, wait for the bid time, and in the next ss you receive the house).
Obs.:
- Can someone help me? even giving tips on how to write this script!
I need a script that delivers houses purchased via website(znote).
SQL:
local query = db.storeQuery("SELECT `id`, `owner`, `bid`, `bid_end`, `highest_bidder` FROM `houses` WHERE `bid_end` <= " .. os.time() .. " AND `highest_bidder` != 0 LIMIT 1;")
the script checks 2 conditions before delivering the house(remembering that there may be more than one house to be delivered, for example 10 houses):
1. if the player has the money in the bank.
2. if the auction time is less than the current time.
Then the house is delivered (setHouseOwner) and the money in the bank is deducted, and if the player does not have the money, the purchase is undone, resetting values such as:
SQL:
db.executeQuery("UPDATE `houses` SET `bid` = 0, `bid_end` = 0, `last_bid` = 0, `highest_bidder` = 0 WHERE `id` = " .. houseNumber .. ";")
Preferably this script will be onStartup type, which will deliver the house as soon as the SS, being even a way to prevent the player from being online and not find a way to bug the gold in the bank (withdraw) before receiving the house.
(system similar to the global, where you buy the house, wait for the bid time, and in the next ss you receive the house).
Obs.:
Lua:
bid = current offer(money)
bid_end = auction end time
last_bid = previous offer(money)
highest_bidder = id player current offer
- Can someone help me? even giving tips on how to write this script!
Last edited: