Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

MySQL help

$
0
0
Alright, I have a problem with a SQL function called DoesPlayerExists, this is the code:

Code:

public OnPlayerConnect(playerid)
{
    DefaultPlayerValues(playerid);
       
        Logged[playerid] = false;
 
    DoesPlayerExist(playerid);
    return true;
}

Code:

public DoesPlayerExist(playerid)
{
    new query[128];
    mysql_format(sqlConnection, query, sizeof(query), "SELECT id FROM users WHERE Name= '%e' LIMIT 1", GetName(playerid));
    mysql_pquery(sqlConnection, query, "SQL_DoesPlayerExist", "i", playerid);
    return true;
}

Code:

public SQL_DoesPlayerExist(playerid)
{
    new exists = -1;
    if(cache_num_rows(sqlConnection) != 0)
    {
      ShowLoginDialog(playerid, "");
    }
    else
    {
        ShowRegisterDialog(playerid, "");
    }
       
        TogglePlayerSpectating(playerid, true);
       
    return exists;
}

It shows the register dialog when needed but it doesn't shows the login one. Don't know why

Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>