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

/save dont save house

mattehj

Member
Joined
Oct 8, 2009
Messages
83
Reaction score
16
Hello. I'm running an otservbr.
And i have a friend who is hosting it. so I can acces to pretty much everything except to restart it.
So what I have done is that I crash the server when I'm like updating the map.
I always do /save before doing it. everything saves except things in house.

I added an auto serversave for this to not happened, But now the server crashed and it reroll til the global SS.
So I have to give everyone back their items again. This is 2 time today, cause I updated the map.
How can I save everything in house?
 
Which server is being used? Can you see console? Is there a log or something in the gm channel to show you a successful execution of a command? If you have some way of positively verifying when you have successfully executed a command, then try

/savehouse
/savehouses
Post automatically merged:

If none of that helps, do you have access to scripts?
 
No reason to be rude? Guess ur parentes forgot to teach u what respect is.
I had to restart the server cause it was a bug on the map.

They just dont understand why you want to crash the server when you can do the command "/closeserver shutdown"

But anyway.. Lets have a look at the code.
"/save" command on otservbr runs this function in its save.lua script: saveServer()

How it looks in source
C++:
lua_register(luaState, "saveServer", LuaScriptInterface::luaSaveServer);

int LuaScriptInterface::luaSaveServer(lua_State* L)
{
    g_game.saveGameState();
    pushBoolean(L, true);
    return 1;
}

It calls g_game.saveGameState() - So lets have a look at this function.
C++:
void Game::saveGameState()
{
    if (gameState == GAME_STATE_NORMAL) {
        setGameState(GAME_STATE_MAINTAIN);
    }

    SPDLOG_INFO("Saving server...");

    for (const auto& it : players) {
        it.second->loginPosition = it.second->getPosition();
        IOLoginData::savePlayer(it.second);
    }

  for (const auto& it : guilds) {
    IOGuild::saveGuild(it.second);
  }

    Map::save();

    g_databaseTasks.flush();

    if (gameState == GAME_STATE_MAINTAIN) {
        setGameState(GAME_STATE_NORMAL);
    }
}

Aha, it loops all players and saves them, loops guilds and saves them.. Hmm.. Does a Map::save(), lets check it.

C++:
bool Map::save()
{
    bool saved = false;
    for (uint32_t tries = 0; tries < 3; tries++) {
        if (IOMapSerialize::saveHouseInfo()) {
            saved = true;
            break;
        }
    }

    if (!saved) {
        return false;
    }

    saved = false;
    for (uint32_t tries = 0; tries < 3; tries++) {
        if (IOMapSerialize::saveHouseItems()) {
            saved = true;
            break;
        }
    }
    return saved;
}


Here you can check the code for saveHouseInfo and saveHouseItems yourself.

But I can see nothing wrong, try using the latest version from github.
 
Now i had the server running for 4 days, I Did /closesever and shutdown. And all houses are rollbacked..

01:01 You see an open door.
It belongs to house 'Central Circle 5'. Nobody owns this house. It costs 840000 gold coins
All items they had in the houses are gone aswell, They don't have them in dp or anywhere :S
 
Now i had the server running for 4 days, I Did /closesever and shutdown. And all houses are rollbacked..

01:01 You see an open door.
It belongs to house 'Central Circle 5'. Nobody owns this house. It costs 840000 gold coins
All items they had in the houses are gone aswell, They don't have them in dp or anywhere :S

Like I said, download latest source from github, compile it
 
I found the error, The auto restarted start a another server when shutdown, So it was 4 sessions open, So when the server shutdowned, You went to session 2 lol
 
Back
Top