sscanf data load problem
#1

So i've got a problem, it wont load the data, and i don't know why, can't find any mistakes, please help me.

So this is thread after entering the password:

pawn Код:
case THREAD_PASSCHECK:
        {
            mysql_store_result();
            if(mysql_num_rows() == 0)
            {
                new str[250];
                SCM(extraid, CRVENA, " (greska) Lozinka koju ste uneli nije ispravna !");
                format(str, sizeof(str), "Dobrodosli na Roleplay Factory %s,\n\nVas nalog je uspesno pronadjen u nasoj bazi podataka !\nUpisite lozinku u polje ispod da se prijavite !", ImeIgraca(extraid));
                SPD(extraid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Prijava", str, "Prijava", "Izlaz");
            }
            mysql_free_result();
            Login(extraid);
        }

and this thread leads us to this stock


pawn Код:
stock Login(playerid)
{
    new Query[300];
    format(Query, sizeof(Query), "SELECT * FROM `Igraci` WHERE `Ime` = '%s' LIMIT 1", ImeIgraca(playerid));
    mysql_query(Query, THREAD_PRIJAVA, playerid);
    return 1;
}
This stock leads us back to:


pawn Код:
case THREAD_PRIJAVA:
        {
            mysql_store_result();
            if(mysql_num_rows() == 0) return SCM(extraid, CRVENA, "Greska pri ucitavanju accounta, pokusajte ponovo..."), Kick(extraid), mysql_free_result();
            new linija[3096];
            mysql_fetch_row(linija);
            mysql_free_result();
            LoadData(extraid, linija);
           
            TogglePlayerSpectating(extraid, 0);
           
            Ulogovan[extraid] = 1;
            GivePlayerMoney(extraid, PI[extraid][Novac]);
           
            SpawnPlayer(extraid);
        }
and this is the data load

pawn Код:
public LoadData(playerid, linija[])
{
    sscanf(linija, "p<|>s[129]s[50]iiis[25]i", PI[playerid][Lozinka], PI[playerid][Email], PI[playerid][Novac], PI[playerid][Spol], PI[playerid][Godine], PI[playerid][Drzava], PI[playerid][Skin]);
}

It wont load the data, on player spawn it's setted to give player a loaded skin but it doesn't and also as you can see it wont give the money, after loading the data.
Reply
#2

Anyone ?
Reply
#3

Shouldn't there be something like
pawn Код:
new Result[70];
db_get_field_assoc(Result, "LOZINKA", Field, 11); PI[playerid][Lozinka] = strval(Field);
db_get_field_assoc(Result, "EMAIL", Field, 24); PI[playerid][Email] = strval(Field);
etc.. to actually get the stuff? ;d
(sorr if i'm wrong, new to the SQL stuff too )
Reply
#4

Kyance code seems to work, it helped me! Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)