is possible?
#1

hey guys , i have this command /houselist and it give's me every player who own a house but i want to give me only players with house who didn't connect for 5 mins let's say so i can test it, in original i will do 1 month but 5 mins for test is even possible ?

Код HTML:
CMD:houselist(playerid, params[])
{
	if(gLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, "Tu nu esti logat si nu poti sa folosesti aceasta comanda!");
	if(!IsManager(playerid)) return SendClientMessage(playerid, COLOR_ERROR, "Nu ai gradul necesar ca sa folosesti aceasta comanda!");
	new aim[500 + 1], tstring[100];
	format(tstring, sizeof(tstring),"{FFFFFF}Lista caselor cumparate");
	new memid = 0;

	gQuery[0] = (EOS);
	mysql_format(handle, gQuery, sizeof(gQuery), "SELECT `AName`,`HouseKey`,`LastLogin` FROM `players` WHERE `HouseKey` > 0 ORDER BY `HouseKey` DESC LIMIT 100");
	new Cache:result = mysql_query (handle, gQuery);

	new iResult[64];
    new test[32], query[32], test1[32];
	new coordsstring[250] = "Name\tCheia de la casa\tLast Login\n";
 	for ( new i, j = cache_get_row_count ( ); i != j; ++i )
	{
		cache_get_field_content(i, "AName", iResult); format(query, 32, iResult);
		format(Selected[memid][snume],32, query);
		cache_get_field_content(i, "HouseKey", iResult); format(test, 32, iResult);
		cache_get_field_content(i, "LastLogin", iResult); format(test1, 32, iResult);
		new id = GetPlayerID(Selected[memid][snume]);

		if(id != INVALID_PLAYER_ID)
		{
			format(gString, sizeof(gString), "{FFFFFF}%s\t%s\tOnline\n", query, test);
			strcat(aim, gString);
		}
		else
		{
  			format(gString, sizeof(gString), "{FFFFFF}%s\t%s\t%s\n", query, test, test1);
     		strcat(aim, gString);
		}
		memid ++;
	}
	cache_delete(result);
    strins(aim, coordsstring, 0);
	ShowPlayerDialog(playerid,3363566,DIALOG_STYLE_TABLIST_HEADERS,tstring,aim,"Alege","Iesi");
	return 1;
}
Reply
#2

Код:
mysql_format(handle, gQuery, sizeof(gQuery), "SELECT `AName`,`HouseKey`,`LastLogin` FROM `players` WHERE `HouseKey` > 0 AND  `LastLogin` + INTERVAL 30 DAY <= NOW()  ORDER BY `HouseKey` DESC LIMIT 100");
is for 1 month, use INTERVAL 5 MINUTE for testing.
Reply
#3

i did it like this

Код HTML:
mysql_format(handle, gQuery, sizeof(gQuery), "SELECT `AName`,`HouseKey`,`LastLogin` FROM `players` WHERE `HouseKey` > 0 AND  `LastLogin` + INTERVAL 5 MINUTE <= NOW()  ORDER BY `HouseKey` DESC LIMIT 100");
but now is not giving me any player who owned a house and he didn't connect for more than 5 minute i have 1 house buyed 2 mins ago and a house buyed 1 weak a go and both are not showing
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)