MySQL Logging player's Master Account in
#1

EDIT:
pawn Код:
forward MasterAccountLogin(playerid, password[]); // Login to an existing master account.
public MasterAccountLogin(playerid, password[])
{
    if(IsPlayerConnected(playerid))
    {
        if(AccountExists(playerid))
        {
            if(strlen(password) >= 1 && strlen(password) <= 20)
            {
                if(MasterAccount[playerid][mLoggedIn])
                {
                    /*new value[128], DBResult:qresult;
                    format(query, sizeof(query), "SELECT * FROM `MainAccount` WHERE ( `username` = '%s' AND `password` = '%s' )", sqlite_escape_string(PlayerName(playerid)), sqlite_escape_string(password));
                    qresult = mysql_query(database, query);
                    if(db_num_rows(qresult) >= 1)*/

                   
                    new rows, fields;
                    new value[128];
                    new query[128];
                    new qresult[128];
                    format(query, sizeof(query), "SELECT * FROM `MasterAccount` WHERE `username` = '%s' AND `mPassword` = '%s'", MasterAccount[playerid][mOriginalUsername] , MasterAccount[playerid][mPassword]);
                    cache_get_data(rows, fields);
                    if(rows >=1)
                    {
                        SetPlayerColor(playerid, COLOR_DARKGREY);// Logged in to master account, yellow = character not spawned.
                        MasterAccount[playerid][mLoggedIn] = true;
                        cache_get_row(qresult, "password", value, 20)format(MasterAccount[playerid][mPassword], 20, value); // 413
                        cache_get_row(qresult, "email_address", value, 30); format(MasterAccount[playerid][mEmailAddress], 30, value); // 414
                        cache_get_row(qresult, "ip_address", value, 20);    format(MasterAccount[playerid][mOld_IP], 20, value); // 415
                        cache_get_row(qresult, "super_admin", value, 5);    MasterAccount[playerid][mSuperAdmin] = strval(value); // 416
                        cache_get_row(qresult, "id", value, 15);    MasterAccount[playerid][mID] = strval(value); // 417
                        mysql_free_result(qresult);
                        ShowMenuDialog(playerid);
                        printf("Password: %s, Email Address: %s, Last IP Used: %s, Super Admin: %d, ID: %d.", MasterAccount[playerid][mPassword],  MasterAccount[playerid][mEmailAddress],  MasterAccount[playerid][mOld_IP], MasterAccount[playerid][mSuperAdmin], MasterAccount[playerid][mID]);
                        return true;
                    }
                    else
                    {
                        SetPVarInt(playerid, "LOGIN_ATTEMPTS", GetPVarInt(playerid, "LOGIN_ATTEMPTS") + 1);
                        switch(GetPVarInt(playerid, "LOGIN_ATTEMPTS"))
                        {
                            case 1: ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Master Account - Login","You entered an invalid password, you have three more attempts before you are auto-kicked.","Login","Cancel");
                            case 2: ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Master Account - Login","You entered an invalid password, you have two more attempts before you are auto-kicked.","Login","Cancel");
                            case 3: ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Master Account - Login","You entered an invalid password, you have one more attempt before you are auto-kicked.","Login","Cancel");
                            case 4: Kick(playerid);
                        }
                    }
                }
            }
            else
            {
                ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Master Account - Login","Account already registered, please enter your password to continue.","Login","Cancel");
            }
        }
    }
    return false;
}
pawn Код:
423) : error 035: argument type mismatch (argument 1)
(424) : error 035: argument type mismatch (argument 1)
(425) : error 035: argument type mismatch (argument 1)
(426) : error 035: argument type mismatch (argument 1)
(427) : error 035: argument type mismatch (argument 1)
(428) : error 017: undefined symbol "mysql_free_result"
Anyone?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)