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

Delete character C++


iFreakTime~.~

Question

3 answers to this question

Recommended Posts

  • 0
  • Premium

Dunno what you really need, but here is solution for known bug:

At server side in ClientManagerPlayer.cpp find:

snprintf(queryStr, sizeof(queryStr), "INSERT INTO player%s_deleted SELECT * FROM player%s WHERE id=%d", GetTablePostfix(), GetTablePostfix(), pi->player_id);
          std::auto_ptr<SQLMsg> pIns(CDBManager::instance().DirectQuery(queryStr));

          if (pIns->Get()->uiAffectedRows == 0 || pIns->Get()->uiAffectedRows == (uint32_t)-1)
          {
                sys_log(0, "PLAYER_DELETE FAILED %u CANNOT INSERT TO player%s_deleted", dwPID, GetTablePostfix());

                peer->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, pi->dwHandle, 1);
                peer->EncodeBYTE(pi->account_index);
                return;
          }

And replace it to:

snprintf(queryStr, sizeof(queryStr), "INSERT INTO player_deleted%s SELECT * FROM player%s WHERE id=%d", GetTablePostfix(), GetTablePostfix(), pi->player_id);
          std::auto_ptr<SQLMsg> pIns(CDBManager::instance().DirectQuery(queryStr));

          if (pIns->Get()->uiAffectedRows == 0 || pIns->Get()->uiAffectedRows == (uint32_t)-1)
          {
                sys_log(0, "PLAYER_DELETE FAILED %u CANNOT INSERT TO player_deleted%s", dwPID, GetTablePostfix());

                peer->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, pi->dwHandle, 1);
                peer->EncodeBYTE(pi->account_index);
                return;
          }

 

 

 

Link to comment
  • 0
36 minutes ago, iFreakTime~.~ said:

This is solution ? "player%s_deleted" to "player_deleted%s" ? 

Sure, the TablePostfix is used to use 2 database intro same server.

If you set  TABLE_POSTFIX = "dev"  the player will become player_dev intro mysql.

 

This is not the correct fix, if you have TABLE_POSTFIX=" " intro CONFIG then player_deleted will become  player _delete wtith one space and this will break database.

But if you have the TABLE_POSTFIX="" this is default postfix and this fix is useless.

 

snprintf(queryStr, sizeof(queryStr), "INSERT INTO player_deleted SELECT * FROM player WHERE id=%d", pi->player_id);
std::auto_ptr<SQLMsg> pIns(CDBManager::instance().DirectQuery(queryStr));

if (pIns->Get()->uiAffectedRows == 0 || pIns->Get()->uiAffectedRows == (uint32_t)-1)
{
	sys_log(0, "PLAYER_DELETE FAILED %u CANNOT INSERT TO player_deleted", dwPID);

	peer->EncodeHeader(HEADER_DG_PLAYER_DELETE_FAILED, pi->dwHandle, 1);
	peer->EncodeBYTE(pi->account_index);
	return;
}

This is the best solution.  Table postfix is shit.

Next use you brain.

  • Good 1
Link to comment

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


  • Read our Rules
  • Activity

    1. 0

      [Land of Heroes] We are looking for Game / Game Economy Designers

    2. 177

      Render Target Remastered

    3. 1

      MySQL stop when start server

    4. 0

    5. 59

      Emoji in TextLine

    6. 1

      MySQL stop when start server

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