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

scripts for guild houses otx2 - tfs 0.3.7

Diarreamental

Banned User
Joined
Jul 6, 2015
Messages
463
Solutions
1
Reaction score
85
Hello


has anyone here an script to disable that nomal players could obtain guildhouses?
in other words that only guild leaders could obtain these guild house, also if they already owns a house should left it to obtain the guild house
 
Solution
made for 1.2
replace you buyhouse talkaction file by this one

Code:
local array_guildhall = {33, 34, 85, 86, 87}
function onSay(player, words, param)
    local housePrice = configManager.getNumber(configKeys.HOUSE_PRICE)
    if housePrice == -1 then
        return true
    end
    if 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 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...
iirc this is already inside the default code, you just need to mark those houses as GH, in Remeres just go to the house, click edit and select Guildhall.

1M6xh6N.png
 
made for 1.2
replace you buyhouse talkaction file by this one

Code:
local array_guildhall = {33, 34, 85, 86, 87}
function onSay(player, words, param)
    local housePrice = configManager.getNumber(configKeys.HOUSE_PRICE)
    if housePrice == -1 then
        return true
    end
    if 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 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:getTileCount() * housePrice
 
 
    if isInArray(array_guildhall, house:getId()) then
        if not player:getGuild() then
            player:sendCancelMessage("You must be a guild leader to buy a guild hall.")
        return false
        end
 
    check_leader = true
 
    local array_levels = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
    for i = 1, #array_levels do
        local RANK = player:getGuild():getRankByLevel(array_levels[i])
            if RANK and player:getGuildLevel() < array_levels[i] then
                check_leader = false
                break
            end
    end
 
    if check_leader ~= true then
        player:sendCancelMessage("You must be a guild leader to buy a guild hall.")
    return false
    end
 
    end
 
    if player:removeMoney(price) then
        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.")
    else
        if player:getItemCount(2157) * 1000000 >= price then
            local nuggs_left = (price / 1000000) - player:getItemCount(2157)
            player:removeItem(2157, player:getItemCount(2157))
            player:addItem(2157, nuggs_left)
            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.")
        else
            player:sendCancelMessage("You do not have enough money.")
        return false
        end
    end
    return false
end
 
Last edited:
Solution
made for 1.2

Code:
local array_guildhall = {33, 34, 85, 86, 87}
function onSay(player, words, param)
    local housePrice = configManager.getNumber(configKeys.HOUSE_PRICE)
    if housePrice == -1 then
        return true
    end
    if 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 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:getTileCount() * housePrice
 
 
    if isInArray(array_guildhall, house:getId()) then
        if not player:getGuild() then
            player:sendCancelMessage("You must be a guild leader to buy a guild hall.")
        return false
        end
 
    check_leader = true
 
    local array_levels = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
    for i = 1, #array_levels do
        local RANK = player:getGuild():getRankByLevel(array_levels[i])
            if RANK and player:getGuildLevel() < array_levels[i] then
                check_leader = false
                break
            end
    end
 
    if check_leader ~= true then
        player:sendCancelMessage("You must be a guild leader to buy a guild hall.")
    return false
    end
 
    end
 
    if player:removeMoney(price) then
        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.")
    else
        if player:getItemCount(2157) * 1000000 >= price then
            local nuggs_left = (price / 1000000) - player:getItemCount(2157)
            player:removeItem(2157, player:getItemCount(2157))
            player:addItem(2157, nuggs_left)
            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.")
        else
            player:sendCancelMessage("You do not have enough money.")
        return false
        end
    end
    return false
end
awesome man but i need it for otx2 - tfs 0.3.7 and i suck in lua,could you make it work in otx2 - tfs 0.3.7?
beforehand thank you
 

Similar threads

Back
Top