My check account with mysql dosen't work
#1

Hi guys! I have a problem.

I just installed my server on mysql plugin (R39-2) with cache and I got a problem. When I enter on server, I always have to register my account again (even if it is already created on mysql table).

I put this in OnPlayerConnect:
PHP код:
new string[128];
format(stringsizeof(string), "SELECT * FROM `accounts` WHERE `username` = '%s'"plname);
mysql_function_query(dbHandlestringtrue"OnQueryFinish""ii"THREAD_CHECK_ACCOUNT_CONNECTplayerid); 
This in OnPlayerRequestClass
PHP код:
switch(gPlayerAccount[playerid])
{
case 
0DisplayDialogForPlayer(playerid2); //register
case 1DisplayDialogForPlayer(playerid1); //login

And this is the CallBack (OnQueryFinish)
PHP код:
public OnQueryFinish(resultidplayeridConnectionHandle)
{
    new 
szRowsszFields;
    if(
resultid != THREAD_NO_RESULT)
    {
        
cache_get_data(szRowsszFields);
    }
    switch(
resultid)
    {
        case 
THREAD_CHECK_ACCOUNT_CONNECT:
        {
            if (
szRows) {
                new 
data[130];            
                
cache_get_field_content(0"Registered"data);
                 
PlayerInfo[playerid][pReg] = strval(data);
                if (
PlayerInfo[playerid][pReg] == 1)
                    
gPlayerLogged[playerid] = 1;
                else 
                    
gPlayerLogged[playerid] = 0;
            } else {
                
gPlayerLogged[playerid] = 0;
            }
        }
    }
    return 
1;

Did you see any wrong? Thanks!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)