• 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!

leave house/sell house

leandroluck

New Member
Joined
Dec 24, 2010
Messages
104
Reaction score
1
I'm wanting to do something that if I have items in the house he does not let the player leave the house or sell the house



leave house
Code:
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

sell house
Code:
function onSay(player, words, param)
    local tradePartner = Player(param)
    if not tradePartner or tradePartner == player then
        player:sendCancelMessage("Trade player not found.")
        return false
    end
    local house = player:getTile():getHouse()
    if not house then
        player:sendCancelMessage("You must stand in your house to initiate the trade.")
        return false
    end
    local returnValue = house:startTrade(player, tradePartner)
    if returnValue ~= RETURNVALUE_NOERROR then
        player:sendCancelMessage(returnValue)
    end
    return false
end
 
Back
Top