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

[TFS 1.0] House saves ides!

Geekbuddys

Member
Joined
Mar 15, 2014
Messages
164
Reaction score
19
Is it possible to make house saves when it been a change in the house? Instead of one hour save?

I mean if i add item or remove any item in the house its make the save only at that house?

Please if you have a kind of skills to make this post it :)
 
Anyone can remake this to tfs 1.0?

Globalevent script
PHP:
function onThink(interval)
    local houses = table.unserialize(getStorage("houses"))
    if(table.maxn(houses) > 0) then
        doSetStorage("houses", "")
        std.clog('>> Saving houses: ' .. table.concat(houses, ', ') .. '...')

        saveServer(houses)
        std.clog('> Done.')
    end

    local result = db.getResult("SELECT `id`, `owner`, `clear` FROM `houses` WHERE `clear` > 0;")
    if(result:getID() ~= -1) then
        repeat
            if(result:getDataInt('clear') == 2) then
                setHouseOwner(result:getDataInt('id'), 0, true)
            end
        until not(result:next())
        result:free()
    end

    return true
end
Creaturescript
PHP:
function onHouseEdit(cid, house, list, text)
    local houses = table.unserialize(getStorage("houses"))
    if(not isInArray(houses, house)) then
        table.insert(houses, house)
    end

    doSetStorage("houses", table.serialize(houses))
    return true
end

@Ninja or @zbizu
 
Back
Top