Jump to content
  • 0

permanent stat increase

Go to solution Solved by Ikarus_,


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);
		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:

	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 post
  • 0


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 post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



Chatroom Rules


Join our Discord

A request for help = Shoutbox Ban

Be respectful & Respect the rules


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