[Tutorial] [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool]
#26

Somehow "OnAccountCheck" isn't being called for me.

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;
}
Only prints

Code:
OnPlayerConnect begin
OnPlayerConnect end
EDIT: used OnQueryError and printed its results, turns out I had some wrong names for a couple columns! Thanks for the tutorial!
Reply


Messages In This Thread
[UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Overhaul - 19.05.2015, 20:48
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Konstantinos - 19.05.2015, 21:25
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Overhaul - 19.05.2015, 21:29
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by MikE1990 - 20.05.2015, 13:47
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by sammp - 20.05.2015, 15:03
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Overhaul - 20.05.2015, 15:06
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by SKAzini - 20.05.2015, 17:54
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Overhaul - 20.05.2015, 17:57
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Antonio144 - 28.05.2015, 17:51
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Overhaul - 29.05.2015, 14:25
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by BR3TT - 29.05.2015, 23:54
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by AndySedeyn - 30.05.2015, 06:11
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by BR3TT - 30.05.2015, 08:04
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by AndySedeyn - 30.05.2015, 08:27
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Overhaul - 30.05.2015, 08:39
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by BR3TT - 30.05.2015, 10:38
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by STONEGOLD - 11.06.2015, 01:20
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Overhaul - 11.06.2015, 16:34
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by STONEGOLD - 11.06.2015, 19:39
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by dudu.r.oliveira - 13.06.2015, 15:46
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Denis1 - 15.06.2015, 13:01
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Overhaul - 15.06.2015, 14:33
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by MD5 - 15.06.2015, 16:49
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Overhaul - 15.06.2015, 17:07
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by sonanclar - 16.06.2015, 01:57
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by JaydenJason - 03.07.2015, 10:14
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by AchievementMaster360 - 10.07.2015, 17:42
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Overhaul - 10.07.2015, 18:01
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Billeen - 20.07.2015, 14:10
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Overhaul - 20.07.2015, 14:21
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by saffierr - 18.03.2016, 13:09
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by AndySedeyn - 18.03.2016, 13:12
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by saffierr - 18.03.2016, 13:15
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by AndySedeyn - 18.03.2016, 13:29
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by saffierr - 18.03.2016, 17:07
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by AndySedeyn - 18.03.2016, 17:32
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Konstantinos - 12.06.2016, 21:36
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by WhiteGhost - 12.06.2016, 23:23
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Slawiii - 13.06.2016, 00:49
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Konstantinos - 13.06.2016, 10:13
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Problems - 16.06.2016, 16:03
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by AndySedeyn - 18.06.2016, 08:55
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Ankon - 02.07.2016, 10:55
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by faizal16 - 30.10.2016, 05:44
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Tenka - 01.12.2016, 05:15
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by AndySedeyn - 01.12.2016, 18:36
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Dorito - 04.12.2016, 09:25
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by KNIGHT786 - 07.12.2016, 13:33
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Yaa - 07.12.2016, 13:34
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by eikzdej - 14.01.2017, 01:42
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Lordzy - 14.01.2017, 04:49
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by eikzdej - 14.01.2017, 11:07
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by Lordzy - 14.01.2017, 14:00
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by justinnater - 18.01.2017, 09:48
Re: [UPDATED 19/05/2015]MySQL Registration System [Threaded Queries + Whirlpool] - by JudyMoody - 24.03.2018, 12:17

Forum Jump:


Users browsing this thread: 3 Guest(s)