Jump to content

Delete character C++


Recommended Posts

  • Bot

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;
          }

 

english_banner.gif

Link to comment
Share on other sites

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