Jump to content
  • 0

Problema Last Login


1Shot

Question

Salut. Vreau sa pun cand intri pe server si trebuie sa te loghezi sa iti apara: * Last Login: data/ora *. Problema este ca nu imi apare... apare asa: * Last Login: *

Adica pur si simplu data si ora nu apar... Nu stiu ce as fi putut face gresit, mie m-i se pare ca e totul ok... Va las mai jos scriptul:

La OnPlayerDisconnect:
	// LAST LOGIN
	new y,m,d,h,mi;
	getdate(y,m,d);
	gettime(h,mi);
	new str[184];
	mysql_format(SQL,str,sizeof(str), "UPDATE users SET `lastOn`='%02d.%02d.%d - %02d:%02d' WHERE `name`='%s'",d,m,y,h,mi,PlayerInfo[playerid][pNormalName]);
	mysql_tquery(SQL,str,"","");

La OnPlayerRequestClass:
		if (gPlayerAccount[playerid] != 0)
		{
            new LastLog[64], loginstring[128];
			cache_get_field_content(playerid, "lastOn", LastLog);
			format(loginstring,sizeof(loginstring), "Welcome to Server, %s!\nPlease enter your password below.\n\n{FFFFFF}* Last Login: %s *", Player, LastLog);
			ShowPlayerDialog(playerid,DIALOG_LOGIN2,DIALOG_STYLE_PASSWORD,"Account Login",loginstring,"Login","Quit");
		}

In Baza de Date (La `users`):

`lastOn` varchar(50) NOT NULL DEFAULT '01/01/1970 01:01:01',

Multumesc!

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

ceva de genu trebuie sa faci


			new laston[32], field[128];
			format(field,sizeof(field),"SELECT `lastOn` FROM `users` WHERE `name`='%s'",GetName(playerid));
			new Cache:last = mysql_query(SQL, field);
			if(cache_num_rows() > 0) cache_get_value(0, "lastOn", laston, 32);
			cache_delete(last);

trebuie sa interoghezi baza de date si sa ceri last login, nu merge doar 

cache_get_field_content(playerid, "lastOn", LastLog);

uita-te pe net cum functioneaza functia

Edited by SherKan
  • Like 1
Citat
Link to comment
Share on other sites

  • 0

Singura problema la care ma pot gandi e faptul ca

cache_get_field_content(playerid, "lastOn", LastLog);

Nu se afla intr-un cache activ

new Cache: result = mysql_query("SELECT lastOn FROM users WHERE Name = 'Nume'");
cache_get_field_content(playerid, "lastOn", LastLog);
cache_delete(result);

(Evident nu tocmai exact asa dar sa fie intr-un cache activ)

mysql_tquery("SELECT lastOn FROM users WHERE Name = 'Nume'", "Functie");

Functie()
{
	cache_get_field_content(playerid, "lastOn", LastLog);
}

Acelasi lucru ca mai sus dar se executa query in alt thread si raspunsul il priemsti intr-o functie

Sguestie de cum ar trebui sa faci ar fi ceva asemanator cu

		if (gPlayerAccount[playerid] != 0)
		{
            new LastLog[64], loginstring[128];

			mysql_format(SQLHandle, loginstring, sizeof(loginstring), "SELECT lastOn FROM users WHERE Name = '%s'", Nume);
			new Cache: result = mysql_query(SQLHandle, loginstring);
			cache_get_field_content(playerid, "lastOn", LastLog);
			cache_delete(result);

			format(loginstring,sizeof(loginstring), "Welcome to Server, %s!\nPlease enter your password below.\n\n{FFFFFF}* Last Login: %s *", Player, LastLog);
			ShowPlayerDialog(playerid,DIALOG_LOGIN2,DIALOG_STYLE_PASSWORD,"Account Login",loginstring,"Login","Quit");
		}

 

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
Answer this question...

×   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.

×
×
  • Create New...

Important Information

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. For more details you can also review our Terms of Use and Privacy Policy.