Jump to content
×
×
  • Create New...
  • 0

permanent stat increase


Hik

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 comment
Share on other sites

2 answers to this question

Recommended Posts

  • 1

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

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

Link to comment
Share on other sites

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


  • Activity

    1. 0

      Looking for Someone to create the queries etc for armors and weapons

    2. 13

      Official Private Shop Search

    3. 944

      [40250] Reference Serverfile + Client + Src [15 Available Languages]

    4. 79

      GUI Teleport System

    5. 0

      inventory slot marking system cant compile

    6. 8

      Inventory Bug

    7. 63

      Metin2 Dev - Changelogs

  • Recently Browsing

    • No registered users viewing this page.

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.