Jump to content

Question about new pet system (time)


Recommended Posts

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

  • 6 months later...

You can not do this because of pet time that you use that system by saving time is used by data type int value what was saved on storage mysql.
You need to make a takeover increment in real time server and decrease in all columns baseline - 1 second.
Which means you will have to do a query directly query that look like to do a check which consists if time is > 0, then you need a query and update query as noted above.

Or you can do an event which is running throughout the game (as long as it receives no crash or other strokes), and through that event can decrease the time of each column of the table in mysql in real time.

  • Here you have 50% of ideea what i was say, for rest you need to use your brain or leave this method.
//@set_global_time 
//Small checks for formate a idea about what i was want to say.
	std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery("SELECT duration FROM user.table"));	
		
	MYSQL_ROW row;
	int resLine = 0;
	
	for(int i = 0; (row = mysql_fetch_row(pMsg->Get()->pSQLResult)) != NULL; ++i) {
		str_to_number(resLine, row[0]);
	}
			
	if (resLine > 0)	
	{
		char sqQuery[QUERY_MAX_LEN + 1];
		snprintf(sqQuery, sizeof(sqQuery), "UPDATE user.table SET duration = duration - 1");
		std::auto_ptr<SQLMsg> msg(DBManager::instance().DirectQuery(sqQuery));
	}
  • You can create and a one vector like: std::vector<int> listDuration; and save all data from storage mysql with all duration and after that to check with one special pointer each and decrease duration.

But anyway, these methods are crap and are not recommended, can not be too familiar with the subject because I do not know how the system works very well your pet so I can't pronounce to something more better on this information.

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.