2025-02-26 13:42:34 +01:00

22 lines
636 B
Lua

function onSay(player, words, param)
local position = player:getPosition()
local tile = Tile(position)
local house = tile and tile:getHouse()
if house == nil then
player:sendCancelMessage("You are not inside a house.")
position:sendMagicEffect(CONST_ME_POFF)
return false
end
if house:getOwnerGuid() ~= player:getGuid() then
player:sendCancelMessage("You are not the owner of this house.")
position:sendMagicEffect(CONST_ME_POFF)
return false
end
house:setOwnerGuid(0)
player:sendTextMessage(MESSAGE_INFO_DESCR, "You have successfully left your house.")
position:sendMagicEffect(CONST_ME_POFF)
return false
end