fix houses to be buyable by website only and rent would be taken from player balance

This commit is contained in:
ErikasKontenis
2020-01-23 21:02:43 +02:00
parent ad7a761167
commit aa779bbdd9
3 changed files with 11 additions and 44 deletions

View File

@@ -85,17 +85,19 @@ function onSay(player, words, param)
end
-- ORDER TYPE 7 (Direct house purchase)
if orderType == 7 then
if q_type == 7 then
served = true
local house = House(orderItemId)
local house = House(q_itemid)
-- Logged in player is not neccesarily the player that bough the house. So we need to load player from db.
local buyerQuery = db.storeQuery("SELECT `name` FROM `players` WHERE `id` = "..orderCount.." LIMIT 1")
print(q_count)
local buyerQuery = db.storeQuery("SELECT `name` FROM `players` WHERE `id` = "..q_count.." LIMIT 1")
if buyerQuery ~= false then
local buyerName = result.getDataString(buyerQuery, "name")
result.free(buyerQuery)
if house then
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. orderId .. ";")
house:setOwnerGuid(orderCount)
db.query("DELETE FROM `znote_shop_orders` WHERE `id` = " .. q_id .. ";")
house:setOwnerGuid(q_count)
player:sendTextMessage(MESSAGE_INFO_DESCR, "You have successfully bought the house "..house:getName().." on "..buyerName..", be sure to have the money for the rent in the bank.")
print("Process complete. [".. buyerName .."] has recieved house: ["..house:getName().."]")
end