Jump to content

[C++] last_play updates in real time


VegaS™
 Share

Recommended Posts

e0505f7b1edfdea16f69157f8408abea.gif

It is for scripts online player or developer php that make connections to the database to achieve something, one who came to me to help him with that worked on a market online and item-shop and no time it was updated in real time and cause them a thousand a problem/bugs.

/*********
* author: 		VegaS
* file:			input_login.cpp
* description: 		Time update in real-time table last_play
* date: 		Tuesday, Aug 01 st 2016, 02:44am
*/

//1.) Search:
void CInputLogin::Entergame(LPDESC d, const char * data)
{
	LPCHARACTER ch;
	[........................................]
} 

//2.) Add bellow:
#ifdef ENABLE_UPDATE_LASTPLAY_REAL_TIME
/*********
* I put this verification level as not to over apply database updates elsewhere for characters that start at
* first on the game that is at level 1, I believe that it is not necessary for a player of that level to have time adapted real-time.
*/
	int pLevel = 5; // To begin initialize of level 5 ++

	if (ch->GetLevel() > pLevel) 
	{	
		char pUpdateTime[1024];
		snprintf(pUpdateTime, sizeof(pUpdateTime), "UPDATE player.player SET last_play = NOW() WHERE id = %u", ch->GetPlayerID());
		std::auto_ptr<SQLMsg> sUpdate(DBManager::instance().DirectQuery(pUpdateTime));
	}
#endif
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...