Jump to content
  • 0

permanent stat increase


Hik
Go to solution Solved by Ikarus_,

Question

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 post

2 answers to this question

Recommended Posts

  • 1
  • 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_ (see edit history)
  • Love 1

My youtube channel  on which you can see my works here

Link to post
  • 0

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.

  • Rainbow 1
Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • 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.