Jump to content

Clear Event Flag


Recommended Posts

Hi there 

 

well i'm trying to clean any event flag with 0 value , 

 

i did like this 

void CClientManager::SetEventFlag(TPacketSetEventFlag* p)
{
	ForwardPacket(HEADER_DG_SET_EVENT_FLAG, p, sizeof(TPacketSetEventFlag));

	// clear event flag
	if (p->lValue == 0)
	{
		typeof(m_map_lEventFlag.begin()) it = m_map_lEventFlag.find(p->szFlagName);
		if (it != m_map_lEventFlag.end())
		{
			m_map_lEventFlag.erase(it);

			char szQuery[1024];
			snprintf(szQuery, sizeof(szQuery),
					"DELETE FROM quest%s WHERE dwPID=0 AND szName='%s'",
					GetTablePostfix(), p->szFlagName);
			szQuery[1023] = '\0';

			CDBManager::instance().AsyncQuery(szQuery);
			sys_log(0, "HEADER_GD_SET_EVENT_FLAG : DELETE CClientmanager::SetEventFlag(%s) ", p->szFlagName);
			return;
		}
	}

	else
	{
		bool bChanged = false;

		typeof(m_map_lEventFlag.begin()) it = m_map_lEventFlag.find(p->szFlagName);
		if (it == m_map_lEventFlag.end())
		{
			bChanged = true;
			m_map_lEventFlag.insert(std::make_pair(std::string(p->szFlagName), p->lValue));
		}
		else if (it->second != p->lValue)
		{
			bChanged = true;
			it->second = p->lValue;
		}

		if (bChanged)
		{
			char szQuery[1024];

			snprintf(szQuery, sizeof(szQuery),
					"REPLACE INTO quest%s (dwPID, szName, szState, lValue) VALUES(0, '%s', '', %ld)",
					GetTablePostfix(), p->szFlagName, p->lValue);

			szQuery[1023] = '\0';

			//CDBManager::instance().ReturnQuery(szQuery, QID_QUEST_SAVE, 0, NULL);
			CDBManager::instance().AsyncQuery(szQuery);
			sys_log(0, "HEADER_GD_SET_EVENT_FLAG : Changed CClientmanager::SetEventFlag(%s %d) ", p->szFlagName, p->lValue);
			return;
		}
		sys_log(0, "HEADER_GD_SET_EVENT_FLAG : No Changed CClientmanager::SetEventFlag(%s %d) ", p->szFlagName, p->lValue);
	}
}

 

it deleted from mysql but it still in game 0 

 

74BHRAA.png

 

is there any mistake in my code , or it doesn't work this way ..

i'm just a beginner xD

 

thanks in advance 

 

 

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 0

      I just implemented some costumes and they are not visible

    2. 0

      Skill Tree Problem

    3. 97

      Ulthar SF V2 (TMP4 Base)

    4. 5

      Client Crashes through Offline Shop (Ikarus)

    5. 5

      VIVY-WORLD2 - FARM TO THE TOP

    6. 0

      ToolTip Bug?

    7. 0

      Skill tree build erorr

    8. 0

      Visual Bug | How to fix this visual bug inside the Special Storage feature?

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • 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.