MySQL problem
#1

I can register the same account multiple times. (well, I have to)

pawn Код:
public OnPlayerConnect(playerid)
{
    SetPlayerColor(playerid, PC);
    new String[128];
    format(String, sizeof(String), ""ORANGE"%s "PURPLE"(%i) "ORANGE"has joined the server. ", GetName(playerid), playerid);
    SendClientMessageToAll(-1, String);
    SetPlayerTime(playerid, 0, 0);
    PlayerMoney[playerid] = -1;
    new Query[200], pName[24];
    GetPlayerName(playerid, pName, 24);
    format(Query, sizeof(Query), "SELECT IP FROM `Players` WHERE Username = '%s' LIMIT 1", pName);
    mysql_query(Query);
    mysql_store_result();
    new Rows = mysql_num_rows();
    if(!Rows)
    {
        ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_PASSWORD, ""#PURPLE"Account system", ""#ORANGE"Register or login below to gain access.", ""PURPLE"Done", "");
    }
    if(Rows == 1)
    {
        new IP[2][16];
        mysql_fetch_field_row(IP[0], "IP");
        GetPlayerIp(playerid, IP[1], 16);
        if(strlen(IP[0]) != 0 && !strcmp(IP[0], IP[1], true))
        {
            Login(playerid);
            SpawnPlayer(playerid);
        }
        else
        {
            ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_PASSWORD, ""#PURPLE"Account system", ""#ORANGE"Register or login below to gain access.", ""PURPLE"Done", "");
            IsPlayerRegistered[playerid] = 1;
        }
    }
    mysql_free_result();
    return 1;
}
What's wrong?
Reply
#2

try the if(!rows) other the other statement
Reply
#3

No idea what do you mean, but I fixed it already.. Used wrong dialog id if there was account with the name. (register dialog instead of login)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)