How could I go about this?
#1

I'm trying to make a system which detects every monday which houses / bussinesses are not used anymore.
So if a player has less than 15 hours played in the last month, it would grab the id of his biz / house from the database, and insert it into the "auctions" category in the database. The "check" needs to look through every single player in the database to detect if he has less hours than 15. How could I do this?
Reply
#2

Use getdate and check what day it is. Update all the fields in the database that meet the criteria you specified, and update another table which says that the update was done, and to do it next Monday.
Reply
#3

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
Use getdate and check what day it is. Update all the fields in the database that meet the criteria you specified, and update another table which says that the update was done, and to do it next Monday.
This is what I have right now. Without the monday part.

Код:
[forward OnAuctionSearch();
public OnAuctionSearch()
{
	new query[256], house, final[256], item, biz, type, pID;
	for(new i; i < 999; i++)
	{
		format(query, sizeof(query), "SELECT * FROM `playeraccounts` WHERE `playerHoursLastMonth` < 60");
		new Cache: aucs = mysql_query(handle, query);
		for(new x, j = cache_get_row_count(); x != j; ++x)
		{
			cache_get_field_content(x, "playerHouse", final); house = strval(final);
			cache_get_field_content(x, "playerBussines", final); biz = strval(final);
			cache_get_field_content(x, "playerID", final); pID = strval(final);
			if(biz > 0)
			{
				format(query, sizeof(query), "INSERT INTO `auctions` (`auctionType`, `auctionItemID`) VALUES ('1', '%d')", biz);
				mysql_tquery(handle, query);
				format(query, sizeof(query), "UPDATE `playeraccounts` SET `playerBussines` = '0' WHERE `playerID` = '%d'", pID);
				mysql_tquery(handle, query);
			}
			if(house > 0) 
			{
				format(query, sizeof(query), "INSERT INTO `auctions` (`auctionType`, `auctionItemID`) VALUES ('2', '%d')", house);
				mysql_tquery(handle, query);
				format(query, sizeof(query), "UPDATE `playeraccounts` SET `playerHouse` = '0' WHERE `playerID` = '%d'", pID);
				mysql_tquery(handle, query);
			}
		}
		cache_delete(aucs);
	}
	return 1;
}
Would this work?
Reply
#4

Have you at least tried it?
Reply
#5

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
Have you at least tried it?
No, as I haven't finished it. I'm just asking if this could work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)