MYSQL Problem..
#1

I went on mysql id, user, admin password but I do not go saving

pawn Код:
public OnPlayerRegister(playerid, password[]) // v1.0 by Luk0r
{
    if(IsPlayerConnected(playerid))
    {
        MySQLCheckConnection();
        new playername3[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername3, sizeof(playername3));
        new newaccountsqlid = MySQLCreateAccount(playername3, password);
        if (newaccountsqlid != 0)
        {
            PlayerInfo[playerid][pSQLID] = newaccountsqlid;
            //PlayerInfo[playerid][pKey] = password;
            strmid(PlayerInfo[playerid][pKey], password, 0, strlen(password), 255);
            OnPlayerUpdate(playerid);
            new loginstring[128];
            new loginname[64];
            GetPlayerName(playerid,loginname,sizeof(loginname));
            format(loginstring,sizeof(loginstring),"Bine ai venit, {91B17A}%s{A9C4E4}\nAcum poti sa te loghezi pe cont:",loginname);
            ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
            return 1;
        }
        else
        {
            SendClientMessage(playerid, 0xFF6347AA, "There was an error creating your account. You will be disconnected now.");
            Kick(playerid);
            return 0;
        }
    }
    return 0;
}

public OnPlayerUpdate(playerid) // by Luk0r v1.2
{
    if(IsPlayerConnected(playerid))
    {
        if(gPlayerLogged[playerid])
        {
            MySQLCheckConnection();
            new query[MAX_STRING];
            format(query, MAX_STRING, "UPDATE players SET ");
            MySQLUpdatePlayerStr(query, PlayerInfo[playerid][pSQLID], "Password", PlayerInfo[playerid][pKey]);
            MySQLUpdatePlayerStr(query, PlayerInfo[playerid][pSQLID], "Sex", PlayerInfo[playerid][pSex]);
            MySQLUpdatePlayerStr(query, PlayerInfo[playerid][pSQLID], "Origin", PlayerInfo[playerid][pOrigin]);
            //MySQLUpdatePlayerStr(query, PlayerInfo[playerid][pSQLID], "FirstLogin", PlayerInfo[playerid][pFLogin]);
            MySQLUpdatePlayerStr(query, PlayerInfo[playerid][pSQLID], "Staff", PlayerInfo[playerid][pStaff]);
            MySQLUpdateFinish(query, PlayerInfo[playerid][pSQLID]);
        }
    }
    return 1;
}

public OnPlayerLogin(playerid,password[]) // by Luk0r v1.0
{
    MySQLCheckConnection();
//  new tmp2[256];
//  new string2[64];
    new playername2[MAX_PLAYER_NAME];
    new playernamesplit[3][MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
    split(playername2, playernamesplit, '_');
    MySQLFetchAcctSingle(PlayerInfo[playerid][pSQLID], "Password", PlayerInfo[playerid][pKey]);
    if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0 )
    {
        new Data[1024];
        new Field[64];
        new rcnt = 1;
        MySQLFetchAcctRecord(PlayerInfo[playerid][pSQLID], Data);
        samp_mysql_strtok(Field, "|", Data);
        while (samp_mysql_strtok(Field, "|", "")==1)
        {
            if (rcnt == 3) PlayerInfo[playerid][pSex] = strval(Field);
            if (rcnt == 4) PlayerInfo[playerid][pOrigin] = strval(Field);
            //if (rcnt == 5) PlayerInfo[playerid][pFLogin] = strval(Field);
            if (rcnt == 5) PlayerInfo[playerid][pStaff] = strval(Field);
            rcnt++;
        }
//          samp_mysql_free_result();
        }
        else
        {
        new loginstring[128];
        new loginname[64];
        GetPlayerName(playerid,loginname,sizeof(loginname));
        format(loginstring,sizeof(loginstring),"PAROLA GRESITA\nTe rog baga parola corecta:",loginname);
        ShowPlayerDialog(playerid,3,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
        gPlayerLogTries[playerid] += 1;
        if(gPlayerLogTries[playerid] == 4) { Ban(playerid); }
        return 1;
    }
    SpawnPlayer(playerid);
    return 1;
}
Reply


Messages In This Thread
MYSQL Problem.. - by GeonMake - 15.06.2011, 21:32
Re: MYSQL Problem.. - by WackoX - 15.06.2011, 21:41
Re: MYSQL Problem.. - by GeonMake - 15.06.2011, 21:43
Re: MYSQL Problem.. - by GeonMake - 15.06.2011, 22:00
Re: MYSQL Problem.. - by GeonMake - 15.06.2011, 22:03
Re: MYSQL Problem.. - by GeonMake - 15.06.2011, 22:34

Forum Jump:


Users browsing this thread: 1 Guest(s)