Hik 108 Posted November 2, 2020 Share Posted November 2, 2020 Hi guys, could someone tell me why, using this code, I can increase the statistics of the pg but when the server is restarted they return to the basic ones? int pc_set_dx0(lua_State* L) { if (!lua_isnumber(L, 1)) return 0; int point = (int)lua_tonumber(L, 1); LPCHARACTER ch = CQuestManager::instance().GetCurrentCharacterPtr(); ch->SetRealPoint(POINT_DX, ch->GetRealPoint(POINT_DX) + point); ch->PointChange(POINT_DX, point); ch->ComputePoints(); ch->PointsPacket(); return 1; } Link to comment Share on other sites More sharing options...
Developer Solution Ikarus_ 2428 Posted November 2, 2020 Developer Solution Share Posted November 2, 2020 (edited) Here it looks to be correct. It must work permanently. I suspect the problem would be how you are 'stopping' the db core. The changes (e.g. ch->SetRealPoint) are not immediatly saved into the player table, the db core has a cache which is flushed (and so saved) every X seconds (Where x is a variable number). The value X is defined here: CPlayerTableCache::CPlayerTableCache() { m_expireTime = MIN(1800, g_iPlayerCacheFlushSeconds); } so it is a number between 0, and 1800. By default this value of seconds is defined here : int g_iPlayerCacheFlushSeconds = 60*7; and it's 7 minutes (you may set it by defining it in the conf.txt by using the key PLAYER_CACHE_FLUSH_SECONDS) Why i m explaning all about this? Because i want to give you way to get what my theory consists. My theory is that you are killing the db process by using killall -9 db or some other command which interrupt the db process, instead of sending a normal stop signal that gives the db time to save changes (currently cached) to the table. My suggestion is to check how your kill script of the channels/db is stopping them. Edited November 2, 2020 by Ikarus_ 1 My youtube channel on which you can see my works here Link to comment Share on other sites More sharing options...
Hik 108 Posted November 2, 2020 Author Share Posted November 2, 2020 Bingo! I also thought that the problem could be the database but I thought that 1-2 minutes would be enough. I did as you said, I added the PLAYER_CACHE_FLUSH_SECONDS variable to the conf.txt and I set a very low time and it worked. Thank you so much for the help but especially for the explanation. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now