• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Feature /save in sources [No lag]

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,858
Reaction score
96
Location
Brazil
Function: Less lag than Talkaction/Globalevent at server save
Author(?): Shynzo in brazilian forum


In commands.cpp after
Code:
{"!joinguild", &Commands::joinGuild},

add
Code:
{"/save",&Commands::saveGame},

At the end in commands.cpp add:
Code:
bool Commands::saveGame(Creature* creature, const std::string& cmd, const std::string& param)
{
        Player* player = creature->getPlayer();
        AutoList<Player>::listiterator it = Player::listPlayer.list.begin();
        
        g_game.saveGameState(true);
        if(player)
                player->sendTextMessage(MSG_STATUS_CONSOLE_ORANGE, "Save server completed.");
        

}

In commands.h after
Code:
bool ghost(Creature* creature, const std::string& cmd, const std::string& param);

add
Code:
bool saveGame(Creature* creature, const std::string& cmd, const std::string& param);
 
g_game.saveGameState(SAVE_PLAYERS);
 
So:

"g_game.saveGameState(true);" or "g_game.saveGameState(SAVE_PLAYERS);"?

And BTW...

Is it faster? I'm using SQL and the save house storage took 10~20 seconds to save, with only 1 player online
 
How to use binary mode?
config.lua of TFS find:
Lua:
useHouseDataStorage = false
and change to true
Be careful, you will lose all items in houses [not really, but they won't appear in houses after server start].
To keep your items in houses start server with that option 'false', edit config.lua (set true), do on GOD /reload config and /save and you got faaaster save and items in houses.
 
Back
Top