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

Solved Problem with command !buyhouse

XenoriaServer

New Member
Joined
May 29, 2018
Messages
10
Reaction score
1
Hello guys. I have a TFS 1.3 client 8.60 and I'm having problems when I try to buy a new house. When I say "!buyhouse", it appear "you not have enough money", although I've on the backpack a lot of. Any idea of how to solve this?
 
Hello guys. I have a TFS 1.3 client 8.60 and I'm having problems when I try to buy a new house. When I say "!buyhouse", it appear "you not have enough money", although I've on the backpack a lot of. Any idea of how to solve this?
Post your buyhouse talkaction
 
I don't know what your script is, but try this one:
Lua:
local config = {
    --[[
        Option 1:
            Attempts to remove all money from the player.

        Option 2:
            Try to remove only the money that is with the player.
    ]]
    option = 2,
    
    level = 1,
    onlyPremium = true
}

function onSay(player, words, param)
    local housePrice = configManager.getNumber(configKeys.HOUSE_PRICE)
    if housePrice == -1 then
        return true
    end

    if player:getLevel() < config.level then
        player:sendCancelMessage("You need level " .. config.level .. " or higher to buy a house.")
        return false
    end

    if config.onlyPremium and not player:isPremium() 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 not house 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:getTileCount() * housePrice
    if config.option == 1 then
        if not player:removeTotalMoney(price) then
            player:sendCancelMessage("You do not have enough money.")
            return false
        end
    else
        if not player:removeMoney(price) then
            player:sendCancelMessage("You do not have enough money.")
            return false
        end
    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.")
    return false
end
 
I don't know what your script is, but try this one:
Lua:
local config = {
    --[[
        Option 1:
            Attempts to remove all money from the player.

        Option 2:
            Try to remove only the money that is with the player.
    ]]
    option = 2,
   
    level = 1,
    onlyPremium = true
}

function onSay(player, words, param)
    local housePrice = configManager.getNumber(configKeys.HOUSE_PRICE)
    if housePrice == -1 then
        return true
    end

    if player:getLevel() < config.level then
        player:sendCancelMessage("You need level " .. config.level .. " or higher to buy a house.")
        return false
    end

    if config.onlyPremium and not player:isPremium() 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 not house 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:getTileCount() * housePrice
    if config.option == 1 then
        if not player:removeTotalMoney(price) then
            player:sendCancelMessage("You do not have enough money.")
            return false
        end
    else
        if not player:removeMoney(price) then
            player:sendCancelMessage("You do not have enough money.")
            return false
        end
    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.")
    return false
end
SOLVED
Thanks a lot bro
 
Back
Top