03.07.2015, 10:14
(
Last edited by JaydenJason; 03/07/2015 at 11:52 AM.
)
Somehow "OnAccountCheck" isn't being called for me.
Only prints
![](http://i.imgur.com/6h8ZsWV.png)
EDIT: used OnQueryError and printed its results, turns out I had some wrong names for a couple columns! Thanks for the tutorial!
Code:
public OnPlayerConnect(playerid) { printf("OnPlayerConnect begin"); new query[128]; PreparePlayerConnection(playerid); mysql_format(mysql, query, sizeof(query), "SELECT `pPassword`, `pID` FROM `accs` WHERE `pName` = '%e' LIMIT 1", PlayerName(playerid)); mysql_tquery(mysql, query, "OnAccountCheck", "i", playerid); printf("OnPlayerConnect end"); return 1; } forward OnAccountCheck(playerid); public OnAccountCheck(playerid) { printf("OnAccountCheck begin"); new rows, fields, welcomestr[200]; cache_get_data(rows, fields, mysql); printf("OnAccountCheck get data"); if(rows) { printf("OnAccountCheck if rows begin"); cache_get_field_content(0, "Password", pData[playerid][pPass], mysql, 129); pData[playerid][pID] = cache_get_field_content_int(0, "pID"); format(welcomestr, sizeof(welcomestr), "Welcome %s!\nYour account has been previously registered in our database.\nPlease fill in your password:", GetPlayerForename(playerid)); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login to MY_TEST_SERVER.", welcomestr, "Login", "Quit"); printf("OnAccountCheck if rows end"); } else { printf("OnAccountCheck else begin"); format(welcomestr, sizeof(welcomestr), "Welcome to MY_TEST_SERVER, %s!\nIt appears that this is your first time playing here!\nPlease fill in your password below\nto register to MY_TEST_SERVER!", GetPlayerForename(playerid)); ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register to MY_TEST_SERVER.", welcomestr, "Register", "Quit"); printf("OnAccountCheck else end"); } printf("OnAccountCheck end"); return 1; }
![](http://i.imgur.com/6h8ZsWV.png)
Code:
OnPlayerConnect begin OnPlayerConnect end