SA-MP Forums Archive
mysql login - 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: mysql login (/showthread.php?tid=359178)



mysql login - SomebodyAndMe - 13.07.2012

Well, I didn't had this problem, it just came up without a reason.

When I try to login, it doesn't get the stats.
Debug log:
Код:
[11:31:57]   [11:31:57] --------------------------- [11:31:57] MySQL Debugging activated (07/13/12) [11:31:57] --------------------------- [11:31:57]   [11:32:03] >> mysql_query( Connection handle: 1 ) [11:32:03] CMySQLHandler::Query(SELECT Ip FROM `PlayerData` WHERE Name = 'Entertainment' LIMIT 1) - Successfully executed. [11:32:03] >> mysql_store_result( Connection handle: 1 ) [11:32:03] CMySQLHandler::StoreResult() - Result was stored. [11:32:03] >> mysql_num_rows( Connection handle: 1 ) [11:32:03] CMySQLHandler::NumRows() - Returned 1 row(s) [11:32:03] >> mysql_free_result( Connection handle: 1 ) [11:32:03] CMySQLHandler::FreeResult() - Result was successfully free'd. [11:32:08] >> mysql_query( Connection handle: 1 ) [11:32:08] CMySQLHandler::Query(SELECT `Name` FROM PlayerData WHERE Name = 'Entertainment' AND Password = 'ABC49B4702575BF21EE02AA55246579824AC80B9057132D677C235CE7E4E0FB0D8D83704FEC166AEB1BCFB7EB47A263194D8A115D14872E2580AA50F725AC3FB') - Successfully executed. [11:32:08] >> mysql_store_result( Connection handle: 1 ) [11:32:08] CMySQLHandler::StoreResult() - Result was stored. [11:32:08] >> mysql_num_rows( Connection handle: 1 ) [11:32:08] CMySQLHandler::NumRows() - Returned 1 row(s) [11:32:08] >> mysql_query( Connection handle: 1 ) [11:32:08] CMySQLHandler::Query(SELECT * FROM `PlayerData` WHERE Name= 'Entertainment') - Successfully executed. [11:32:08] >> mysql_store_result( Connection handle: 1 ) [11:32:08] CMySQLHandler::StoreResult() - Result was stored. [11:32:08] >> mysql_fetch_row_format( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchRow() - Return: 25|Entertainment|ABC49B4702575BF21EE02AA55246579824AC80B9057132D677C235CE7E4E0FB0D8D83704FEC166AEB1BCFB7EB47A263194D8A115D14872E2580AA50F725AC3FB|6|0|346|0|0|0|1|1|0|1|1|0|12000|300|6|10|10|10|10|0|0|0|0|0|145500|255.255.255.255|0|0|0 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("Name") - Entertainment [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("PlayerLevel") - 6 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("Jailed") - 0 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("Score") - 346 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("Wanted") - 0 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("Bans") - 0 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("BanTime") - 0 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("TruckerLicense") - 1 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("BusLicense") - 1 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("Muted") - 0 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("RulesRead") - 1 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("SRT") - 1 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("PSwork") - 0 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("StatsMetersDriven") - 12000 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("StatsTruckerJobs") - 300 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("StatsConvoyJobs") - 6 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("StatsBusDriverJobs") - 10 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("StatsPilotJobs") - 10 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("StatsMafiaJobs") - 10 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("StatsMafiaStolen") - 10 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("StatsPoliceFined") - 0 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("StatsPoliceJailed") - 0 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("StatsAssistance") - 0 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("StatsCourierJobs") - 0 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("StatsRoadworkerJobs") - 0 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("Money") - 145500 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("Ip") - 255.255.255.255 [11:32:08] >> mysql_fetch_field_row( Connection handle: 1 ) [11:32:08] CMySQLHandler::FetchField("OFWarns") - 0 [11:32:08] >> mysql_fetch_row_format( Connection handle: 1 ) [11:32:08] >> mysql_free_result( Connection handle: 1 ) [11:32:08] CMySQLHandler::FreeResult() - Result was successfully free'd.
The MySQL Login:
pawn Код:
stock MySQL_Login(playerid)
{
    new query[128], pname[24], savingstring[20], savingstring1[20], savingstring2[20], savingstring3[20], savingstring4[20];
    GetPlayerName(playerid, pname, 24);
    format(query, sizeof(query), "SELECT * FROM `PlayerData` WHERE Name= '%s'", pname);
    mysql_query(query);
    mysql_store_result();
    while(mysql_fetch_row_format(query,"|"))
    {
        mysql_fetch_field_row(savingstring, "Name"); APlayerData[playerid][PlayerName] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "PlayerLevel"); APlayerData[playerid][PlayerLevel] = strval(savingstring); //2.
        mysql_fetch_field_row(savingstring, "Jailed"); APlayerData[playerid][PlayerJailed] = strval(savingstring); //3.
        mysql_fetch_field_row(savingstring, "Score"); RewardPlayer(playerid, 0, strval(savingstring)); //4.
        mysql_fetch_field_row(savingstring, "Wanted"); SetPlayerWantedLevel(playerid,strval(savingstring)); //5.
        mysql_fetch_field_row(savingstring, "Bans"); APlayerData[playerid][Bans] = strval(savingstring); //6.
        mysql_fetch_field_row(savingstring, "BanTime"); APlayerData[playerid][BanTime] = strval(savingstring); //7.
        mysql_fetch_field_row(savingstring, "TruckerLicense"); APlayerData[playerid][TruckerLicense] = strval(savingstring); //8
        mysql_fetch_field_row(savingstring, "BusLicense"); APlayerData[playerid][BusLicense] = strval(savingstring); //9.
        mysql_fetch_field_row(savingstring1, "Muted");
        if(strval(savingstring1) == 1)
        {
            APlayerData[playerid][Muted] = true; //11.
        }
        else
        {
            APlayerData[playerid][Muted] = false;
        }

        mysql_fetch_field_row(savingstring2, "RulesRead");
        if(strval(savingstring2) == 1)
        {
            APlayerData[playerid][RulesRead] = true; //11.
        }
        else
        {
            APlayerData[playerid][RulesRead] = false;
        }
        mysql_fetch_field_row(savingstring3, "SRT");
        if(strval(savingstring3) == 1)
        {
            APlayerData[playerid][SRT] = true; //11.
        }
        else
        {
            APlayerData[playerid][SRT] = false;
        }

        mysql_fetch_field_row(savingstring4, "PSwork");
        if(strval(savingstring4) == 1)
        {
            APlayerData[playerid][PSwork] = true; //11.
        }
        else
        {
            APlayerData[playerid][PSwork] = false;
        }

        mysql_fetch_field_row(savingstring, "StatsMetersDriven");APlayerData[playerid][StatsMetersDriven] = strval(savingstring); //14.
        mysql_fetch_field_row(savingstring, "StatsTruckerJobs"); APlayerData[playerid][StatsTruckerJobs] = strval(savingstring); //15.
        mysql_fetch_field_row(savingstring, "StatsConvoyJobs"); APlayerData[playerid][StatsConvoyJobs] = strval(savingstring); //16.
        mysql_fetch_field_row(savingstring, "StatsBusDriverJobs"); APlayerData[playerid][StatsBusDriverJobs] = strval(savingstring); //17.
        mysql_fetch_field_row(savingstring, "StatsPilotJobs"); APlayerData[playerid][StatsPilotJobs] = strval(savingstring); //18.
        mysql_fetch_field_row(savingstring, "StatsMafiaJobs"); APlayerData[playerid][StatsMafiaJobs] = strval(savingstring); //19.
        mysql_fetch_field_row(savingstring, "StatsMafiaStolen"); APlayerData[playerid][StatsMafiaStolen] = strval(savingstring); //20.
        mysql_fetch_field_row(savingstring, "StatsPoliceFined"); APlayerData[playerid][StatsPoliceFined] = strval(savingstring); //21.
        mysql_fetch_field_row(savingstring, "StatsPoliceJailed"); APlayerData[playerid][StatsPoliceJailed] = strval(savingstring); //22.
        mysql_fetch_field_row(savingstring, "StatsAssistance"); APlayerData[playerid][StatsAssistance] = strval(savingstring); //23.
        mysql_fetch_field_row(savingstring, "StatsCourierJobs"); APlayerData[playerid][StatsCourierJobs] = strval(savingstring); //24.
        mysql_fetch_field_row(savingstring, "StatsRoadworkerJobs"); APlayerData[playerid][StatsRoadworkerJobs] = strval(savingstring); //25.
        mysql_fetch_field_row(savingstring, "Money"); RewardPlayer(playerid, strval(savingstring), 0); //26.
        mysql_fetch_field_row(savingstring, "Ip"); APlayerData[playerid][SpelerIPAdres] = strval(savingstring); //27.
        mysql_fetch_field_row(savingstring, "OFWarns"); APlayerData[playerid][OFWarns] = strval(savingstring); //28.
        //mysql_fetch_field_row(savingstring, "house1"); APlayerData[playerid][Houses][HouseSlot] = strval(savingstring); // Store the HouseID at the selected slot
    }
    mysql_free_result();

    return 1;
}
The dialog for the login:
pawn Код:
// Process the login-dialog
Dialog_Login(playerid, response, inputtext[])
{
    switch (response) // Check which button was clicked
    {
        case 1: // Player clicked "Login"
        {
            // Check if the player entered a password
            if (strlen(inputtext) > 0)
            {
                // Check if the entered password is the same as the password saved in the player's account
                    new query[500], pname[24];
                GetPlayerName(playerid, pname, 24);
                new FinalPassword[132];
                WP_Hash(FinalPassword, sizeof(FinalPassword), inputtext);
                format(query, sizeof(query), "SELECT `Name` FROM PlayerData WHERE Name = '%s' AND Password = '%s'", pname, FinalPassword);
               
                mysql_query(query);
                        mysql_store_result();
                       
                new numrows = mysql_num_rows();
                        if(numrows == 1) MySQL_Login(playerid);
               
                else if(numrows == 0)
                        {
                            ShowPlayerDialog(playerid,DialogLogin, DIALOG_STYLE_PASSWORD, "Transporter Login","{FFFFFF}Welcome to the server\nyou are {00FF00}Registered {FFFFFF}Please Login to continue\n{ff0000}Incorrect Password Entered","Login","quit");

                        }

                APlayerData[playerid][LoggedIn] = true;
                APlayerData[playerid][PlayerPassword] = 1;
                mysql_free_result();

            }

        }
        case 0: // Player clicked "Cancel"
        {
            // Show a message that the player must be logged in to play on this server
            SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerMustLogin);
            // Kick the player
            Kick(playerid);
        }
    }

    return 1;
}

What is wrong? I don't see any problems..


Re: mysql login - SomebodyAndMe - 13.07.2012

Any?


Re: mysql login - SomebodyAndMe - 13.07.2012

Tried to fix it, failed, anyone who can help me on this?


Re: mysql login - SomebodyAndMe - 13.07.2012

lright I promise, this will be my last bump, after that I'll throw the towel in the ring.


Re: mysql login - FireCat - 13.07.2012

YOU JUST FUCKING TRIPLED POSTED!
-_-


Re: mysql login - CoDeZ - 13.07.2012

pawn Код:
Dialog_Login(playerid, response, inputtext[])
Shouldn't this be , OnDialogResponse(playerid,dialogid,response,listit em,inputtext[])
?


Re: mysql login - SomebodyAndMe - 13.07.2012

Found the problem.Sorry for the bumps, and hectic I've created with this topic.