mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-10-14 14:44:55 +02:00
fix houses to be buyable by website only and rent would be taken from player balance
This commit is contained in:
@@ -1,36 +1,4 @@
|
||||
function onSay(player, words, param)
|
||||
if player:getPremiumDays() <= 0 then
|
||||
player:sendCancelMessage("You need a premium account.")
|
||||
return false
|
||||
end
|
||||
|
||||
local position = player:getPosition()
|
||||
position:getNextPosition(player:getDirection())
|
||||
|
||||
local tile = Tile(position)
|
||||
local house = tile and tile:getHouse()
|
||||
if house == nil then
|
||||
player:sendCancelMessage("You have to be looking at the door of the house you would like to buy.")
|
||||
return false
|
||||
end
|
||||
|
||||
if house:getOwnerGuid() > 0 then
|
||||
player:sendCancelMessage("This house already has an owner.")
|
||||
return false
|
||||
end
|
||||
|
||||
if player:getHouse() then
|
||||
player:sendCancelMessage("You are already the owner of a house.")
|
||||
return false
|
||||
end
|
||||
|
||||
local price = house:getRent() * 5
|
||||
if not player:removeMoney(price) then
|
||||
player:sendCancelMessage("You do not have enough money.")
|
||||
return false
|
||||
end
|
||||
|
||||
house:setOwnerGuid(player:getGuid())
|
||||
player:sendTextMessage(MESSAGE_INFO_DESCR, "You have successfully bought this house, be sure to have the money for the rent in the bank.")
|
||||
player:sendTextMessage(MESSAGE_INFO_DESCR, "Buying a house is available only through auction which is available at website: https://sabrehaven.com/house.php")
|
||||
return false
|
||||
end
|
||||
|
Reference in New Issue
Block a user