SA-MP Forums Archive
mysql help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: mysql help (/showthread.php?tid=242573)



mysql help - xTeChNiQuEz-- - 20.03.2011

I have this code to login, but even if he gets the password wrong it says "You successfully logged in"
I can't get it why?
pawn Код:
if(dialogid == Logindialog)
    {
        if(!response) return Kick(playerid) && SendClientMessage(playerid,red,"Have it you're way");
        new string[200];
        format(Query, sizeof(Query), "SELECT * FROM `Accounts` WHERE `Username` = '%s' AND `Password` = '%s'",
        GetPName(playerid),
        inputtext);
        mysql_query(Query);
        if(!mysql_num_rows())
        {
            PInfo[playerid][Failedlogins] ++;
            format(string,sizeof(string),""lred"You have failed %i/3 times you're login \n"lwhite"Hey "lgreen"%s"lwhite", you're account is registered \n"lwhite"Please enter a password to continue\n"lwhite"Or press cancel to "lred"leave",PInfo[playerid][Failedlogins],GetPName(playerid));
            ShowPlayerDialog(playerid,Logindialog,1,"Login",string,"Ok","Cancel");
            if(PInfo[playerid][Failedlogins] == 3)
            {
                format(string,sizeof(string),"||- Announcement: %s has failed 3 times login and has been kicked -||",GetPName(playerid));
                Kick(playerid);
                SendAdminMessage(white,string);
            }
            return 1;
        }
        SendClientMessage(playerid,yellow,"You have successfully logged in!");
    }



Re: mysql help - JamesC - 20.03.2011

You need to use mysql_store_result(); after your query.


Re: mysql help - xTeChNiQuEz-- - 20.03.2011

Quote:
Originally Posted by JamesC
Посмотреть сообщение
You need to use mysql_store_result(); after your query.
nvm i fixed it mah self.