SA-MP Forums Archive
SQLite - Load function problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SQLite - Load function problem (/showthread.php?tid=548386)



SQLite - Load function problem - Psyhophatic - 29.11.2014

Hello everyone !
Recently I started to learn how SQLite work and I've tried to make a database using it, but I have some problems with the Load function

Here it's the code:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new DBResult:res,ip[16];
    GetPlayerIp(playerid,ip,sizeof(ip));
    switch(dialogid)
    {
        case 1: // Register
        {
            if(response)
            {
                format(str,sizeof(str),"SELECT * FROM `USERS` WHERE `NAME` = '%s' COLLATE NOCASE AND `PASSWORD` = '%s'",Escape(GetName(playerid)),Escape(inputtext));
                res=db_query(users,str);
           /*if(db_num_rows(res))
                {
                    db_get_field_assoc(res,"LEVEL",field,30);
                    SetPlayerScore(playerid,strval(field));
                    SendClientMessage(playerid,0x000000ff,"You logged in !");
                }*/

                else ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login","Please enter your password","Login","Exit");
                db_free_result(res);
            }
            else return Kick(playerid);
        }
And I want to put this
pawn Код:
if(db_num_rows(res))
                {
                    db_get_field_assoc(res,"LEVEL",field,30);
                    SetPlayerScore(playerid,strval(field));
                    SendClientMessage(playerid,0x000000ff,"You logged in !");
                }
inside this function
pawn Код:
public Load(playerid)
{
    return 1;
}



Re: SQLite - Load function problem - Psyhophatic - 29.11.2014

Nobody ?