Mysql login/register system questions
#1

Hello guys im trying to adapt this tutorial in r33 mysql plugin.

I know both r33 and that tutorial is too much old but i want to spend some time on it as im a noob on scripting im trying to understand too.

I will share my code and what it was in tutorial and we can go on if anyone wants to help.

My Code:
Код:
    new Query[80],pName[24];
	GetPlayerName(playerid,pName,24);
	mysql_format(Myhandle,Query,sizeof(Query),"SELECT Username FROM Users WHERE Username = '%d'",pName);
	mysql_tquery(Myhandle,Query);
	
	if (cache_get_row_count() != 0)
	{
	    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Welcome to SS-RP. Please Login.", "", "Login", "Cancel");
	}
	else if (cache_get_row_count() == 0)
	{
	    ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "Welcome to SS-RP. Please Register.", "", "Register", "Cancel");
	}
i dont know if this cache_get_row_count will work because we didnt use any cached string by the cache function how can i fix that?

also

Код:
mysql_fetch_row_format(Query, "|");
sscanf(Query, "e<p<|>s[24]s[23]i>", PInfo[playerid]);
mysql_free_result();
GivePlayerMoney(playerid,PInfo[playerid][Money]);
i dont know what on earth this code means or how it works(wth sscanf?) and i cant translate it to new type codes.
Reply
#2

Tqueries must use a callback for the cache_ functions to return anything.

Quote:
Originally Posted by grymtn
Посмотреть сообщение
also

Код:
mysql_fetch_row_format(Query, "|");
sscanf(Query, "e<p<|>s[24]s[23]i>", PInfo[playerid]);
mysql_free_result();
GivePlayerMoney(playerid,PInfo[playerid][Money]);
i dont know what on earth this code means or how it works(wth sscanf?) and i cant translate it to new type codes.
That's outdated and it doesn't even work anymore so it can't be "translated". Each field is now retrieved separately.

I'd love to write more but I really don't have time right now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)