SA-MP Forums Archive
Server crashes on db_get_field_assoc - 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: Server crashes on db_get_field_assoc (/showthread.php?tid=415814)



Server crashes on db_get_field_assoc - TBeavis - 14.02.2013

pawn Код:
if(dialogid==LOGIN)
{
        if(!response) return Kick(playerid);
        if(IsPlayerConnected(playerid))
        {
            new DBResult:query, string[256];
            format(string, sizeof(string), "SELECT * FROM `Accounts` WHERE `Name`='%s' AND `Password`='%s'", DB_Escape(GetPlayerNameEx(playerid)),(inputtext));
            query = db_query(Server, string);
            if(db_num_rows(query) > 0)
            {
                new szValue[64];
                db_get_field_assoc(query, "Adminlevel", szValue, sizeof(szValue));
                pInfo[playerid][pAdminlevel] = strval(szValue);
                SendClientMessage(playerid,orange,"Successfully logged in!");
            }
            else if(db_num_rows(query)<1)
            {
                new str2[52],str1[2000];
                format(str2,sizeof(str2),"'-' login: %s",GetPlayerNameEx(playerid));
                format(str1,2000,"%sWelcome back to '-' the hell on earth!\n",str1);
                format(str1,2000,"%sWe missed you and are happy to see that you came back.\n",str1);
                format(str1,2000,"%sMake sure that you read our /rules and /news to keep updated!\n",str1);
                ShowPlayerDialog(playerid,101,DIALOG_STYLE_PASSWORD,str2,str1,"Login","Kick");
            }
            db_free_result(query);
        }
}
I debugged it thus I know it crashes on db_get_field_assoc. I'm able to provide any information needed.

Thanks.