• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

convert script tfs 1.2 to tfs 0.3.7[OTX]

Diarreamental

Banned User
Joined
Jul 6, 2015
Messages
463
Solutions
1
Reaction score
85
hello
can anybody convert this script to to tfs 0.3.7[OTX]
pls
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
 
Back
Top