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

Reset storagevalue

freaked1

Active Member
Joined
Jan 30, 2008
Messages
486
Solutions
5
Reaction score
29
Location
Sweden
Hello! Is there anyone that can make or know of a script that removes certain storageIDs on players after serverrestart so that quests that checks that storage ID gets reset for the player? :)

EDIT: Using TFS 1.1

Thanks in advance.
 
Last edited:
Hello! Is there anyone that can make or know of a script that removes certain storageIDs on players after serverrestart so that quests that checks that storage ID gets reset for the player? :)

EDIT: Using TFS 1.1

Thanks in advance.
You could do this when the server starts up send a query to the database and so the server will handle all of the entries rather than doing it when each player logs in.
Code:
local storages = {
    -- place the storage values here
}

for i = 1, #storages do
    db.query("UPDATE `player_storage` SET `value` = 0 WHERE `storage` = " .. storages[i] .. ";")
end
While placing it somewhere in startup.lua forgottenserver/data/globalevents/scripts/startup.lua
 
You could do this when the server starts up send a query to the database and so the server will handle all of the entries rather than doing it when each player logs in.
Code:
local storages = {
    -- place the storage values here
}

for i = 1, #storages do
    db.query("UPDATE `player_storage` SET `value` = 0 WHERE `storage` = " .. storages[i] .. ";")
end
While placing it somewhere in startup.lua forgottenserver/data/globalevents/scripts/startup.lua

Update to 0 doesn't mean the storage is gone.
Many storages uses 0 as something.
better use DELETE FROM.
 
So then change it to -1
why not clean the database while doing this? than keep all old unnecessary stuffs.

That code is a chance to clean up a huge amount of storages from players that maybe doesn't even play.
Take the chance if chance is given :)
 
why not clean the database while doing this? than keep all old unnecessary stuffs.

That code is a chance to clean up a huge amount of storages from players that maybe doesn't even play.
Take the chance if chance is given :)
Because he asked to reset the storages not delete them :)
 
Hello! Is there anyone that can make or know of a script that removes certain storageIDs on players after serverrestart so that quests that checks that storage ID gets reset for the player? :)

EDIT: Using TFS 1.1

Thanks in advance.

Because he asked to reset the storages not delete them :)
 
Thanks guys! You both really helped out here. I'm "new" and trying to learn and this really helped show the way :)
Using this now in startup.lua
Code:
    local storages = {
        -- place the storage values here
        25000
    }

    for i = 1, #storages do
        db.query("DELETE FROM `player_storage` WHERE `key` = " .. storages[i] .. ";")
    end

EDIT: i
 
Last edited:
Thanks guys! You both really helped out here. I'm "new" and trying to learn and this really helped show the way :)
Using this now in startup.lua
Code:
    local storages = {
        -- place the storage values here
        25000
    }

    for i = 1, #storages do
        db.query("DELETE FROM `player_storage` WHERE `key` = " .. storages .. ";")
    end
You forgot the i this should be
Code:
db.query("DELETE FROM `player_storage` WHERE `key` = " .. storages[i] .. ";")
 
You forgot the i this should be
Code:
db.query("DELETE FROM `player_storage` WHERE `key` = " .. storages[i] .. ";")

Yeah for some reason it didn't show when I posted it here, might be beacuse I fkd up the CODE tag at first and edited it :p It works fine, I have the correct with storages in my starup.lua ;)

Ah, it makes the text like this, that is why :p
 
Back
Top