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

[TFS 1.4] CLEAN HOUSE BY TALKACTION

adric21

Well-Known Member
Joined
Apr 26, 2016
Messages
270
Solutions
1
Reaction score
70
clean houses with a single command, I hope it works for you.

Credits:
-CaduGTX
-Adriczao
-Kutz
Lua:
local function doCheckHouses()

    local registros = db.storeQuery(
                          "SELECT `houses`.`owner`, `houses`.`id` FROM `houses`,`players` WHERE `houses`.`owner` != 0 AND `houses`.`owner` = `players`.`id`;")

    if registros ~= false then
        local count = 0

        repeat
            count = count + 1

            local owner = result.getNumber(registros, "owner")
            local houseId = result.getNumber(registros, "id")
            local house = House(houseId)

            if house and (owner > 0) then
                print(house:getName())
                house:setOwnerGuid(0)
            end
        until not result.next(registros)
        result.free(registros)
    end
    print('Houses Cleaned')
    return true
end

local cleanhouse = TalkAction("/cleanhouse")

function cleanhouse.onSay(player, words, param)
    if not player:getGroup():getAccess() or player:getAccountType() <
        ACCOUNT_TYPE_GOD then
        player:sendCancelMessage("Only admins can use this command.")
        return true
    end
    addEvent(doCheckHouses, 10 * 1000)
    player:sendCancelMessage("Cleaning houses.")
    return true
end

cleanhouse:separator(" ")
cleanhouse:register()
 
Back
Top