Jump to content

permanent stat increase


Go to solution Solved by Ikarus_,

Recommended Posts

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

  • Developer
  • Solution

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 by Ikarus_
  • Love 1

My youtube channel  on which you can see my works here

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.