Mysql + PVar
#1

I don't know is this a Sa:Mp 0.3c bug or not, but when i load a Mysql data on PVar my server goes down and i get this crash in my server folder:

SA-MP Server: 0.3c RC2



Exception At Address: 0x6BD7B690



Registers:

EAX: 0x0268B048 EBX: 0x029807D4 ECX: 0x00000000 EDX: 0x00256F78

ESI: 0x0012F498 EDI: 0x018EE878 EBP: 0x0012F45C ESP: 0x0012F450

EFLAGS: 0x00010246



Stack:

+0000: 0x6BDF5D9D 0x00000000 0x018EE878 0x0012F490

+0010: 0x100090B4 0x00000000 0x74AD51CE 0x0012F498

+0020: 0x029807D4 0x00256F78 0x6BDF7296 0x00000001

+0030: 0x00000000 0x0012F4F4 0x10009B1D 0x00000000

+0040: 0x0012F500 0x100066B3 0x100099FB 0x69746150

+0050: 0x73697472 0x10006600 0x0012F4CC 0x00000008

+0060: 0x0000000F 0x74AD505E 0x00000078 0x0012F498

+0070: 0x004067AD 0x00000078 0x0012F498 0x00000005

+0080: 0x69746150 0x73697472 0x00406800 0x029F4B1C

+0090: 0x00000008 0x0000000F 0x74AD505E 0x00256F78

+00A0: 0x00000000 0x0012F814 0x10009C70 0x00000000

+00B0: 0x029997FC 0x00401096 0x018EE878 0x029F8820

+00C0: 0x02999A10 0x00402BB3 0x018EE878 0x00000025

+00D0: 0x0012F538 0x029F8820 0x0012F824 0x018EE878

+00E0: 0x00000000 0x00000000 0x00000000 0x0005EE0C

+00F0: 0x0005EE10 0x0005F108 0x0005B124 0x0005F0E8

+0100: 0x0005B124 0x029807D4 0x02999A10 0x00000000

+0110: 0x0297FA20 0x0001923C 0x0048398B 0x018EE878

+0120: 0x0012F5B8 0x00000002 0x018EE878 0x00000000

+0130: 0x018EE878 0x00000001 0x018EE878 0x00000001
Reply
#2

Could you show us the piece of code that makes this happen please?
Reply
#3

pawn Код:
if( dialogid == 1 )
    {
        if( response )
        {
            new
                query[ 128 ],
                str[ 50 ];
               
               
            format( query, sizeof( query ), "SELECT `Slaptazodis`, `Patirtis`, `Admin` FROM `zaidejai` WHERE `id` = %d", GetPVarInt( playerid, "sqlidas" ) );
            mysql_query( query );
            mysql_store_result();
            mysql_fetch_row( query );
           
            mysql_fetch_field_row( str, "Slaptazodis" );
           
            if ( !strcmp(str, inputtext, true) )
            {
                mysql_fetch_field_row( str, "Patirtis" );
                new
                    exp = strval( str );

                mysql_fetch_field_row( str, "Admin" );
                SetPVarInt( playerid, "Adminas", strval( str ) );


                if(exp == -1) SetPVarInt( playerid, "Authstate", 1 ); else
                SetPVarInt( playerid, "Authstate", 2 );
               
                mysql_free_result();
                return 1;
            }
            ShowPlayerDialog( playerid, 1, DIALOG_STYLE_INPUT, "Serverio prisijungimas.", "Prasome prisijungti", "Prisijungti", "Atsaukti");
            return 1;
        }
       
        if( !response )
        {
            ShowPlayerDialog( playerid, 0, DIALOG_STYLE_MSGBOX, "Tikimes sulaukti jusu sugryztant" );
            Kick( playerid );
    }
Reply
#4

This code work on 0.3b?
Reply
#5

I'll try it.

Edit: Yes, it works fine.
Reply
#6

Could you try to identify which line is causing the issue? To do this, add prints between your current code lines, and after the crash happens, check which print is the last shown in the server_log.txt file.
Try using this code, with the print lines already added:

pawn Код:
if( dialogid == 1 )
    {
        print("debug a");
        if( response )
        {
            print("debug b");
            new
                query[ 128 ],
                str[ 50 ];
               
            print("debug c");              
            format( query, sizeof( query ), "SELECT `Slaptazodis`, `Patirtis`, `Admin` FROM `zaidejai` WHERE `id` = %d", GetPVarInt( playerid, "sqlidas" ) );
            print("debug d");
            mysql_query( query );
            print("debug e");
            mysql_store_result();
            print("debug f");
            mysql_fetch_row( query );
           
            print("debug g");
            mysql_fetch_field_row( str, "Slaptazodis" );
           
            print("debug h");
            if ( !strcmp(str, inputtext, true) )
            {
                print("debug i");
                mysql_fetch_field_row( str, "Patirtis" );
                print("debug J");
                new
                    exp = strval( str );

                print("debug k");
                mysql_fetch_field_row( str, "Admin" );
                print("debug L");
                SetPVarInt( playerid, "Adminas", strval( str ) );
                print("debug m");

                print("debug m");
                if(exp == -1) SetPVarInt( playerid, "Authstate", 1 ); else
                SetPVarInt( playerid, "Authstate", 2 );
                print("debug o");
               
                mysql_free_result();
                print("debug p");
                return 1;
            }
            print("debug q");
            ShowPlayerDialog( playerid, 1, DIALOG_STYLE_INPUT, "Serverio prisijungimas.", "Prasome prisijungti", "Prisijungti", "Atsaukti");
            print("debug r");
            return 1;
        }

        print("debug s");
        if( !response )
        {
            print("debug t");
            ShowPlayerDialog( playerid, 0, DIALOG_STYLE_MSGBOX, "Tikimes sulaukti jusu sugryztant" );
            print("debug u");
            Kick( playerid );
            print("debug v");
    }
Make sure to backup your current code, so you can revert to it easily afterwards.
Thank you.
Reply
#7

[21:40:22] Incoming connection: 127.0.0.1:62267
[21:40:22] [join] Jean_Manian has joined the server (0:127.0.0.1)
[21:40:27] debug a
[21:40:27] debug b
[21:40:27] debug c
[21:40:27] debug d
[21:40:27] debug e
[21:40:27] debug f
[21:40:27] debug g
[21:40:27] debug h
[21:40:27] debug i

So, the last print is "debug i" and the line after this print is:

pawn Код:
mysql_fetch_field_row( str, "Patirtis" );
Reply
#8

Looks like a problem with the plugin you are using. If you weren't having problems with 0.3b, then maybe there is some incompatibility between the plugin and the new sa-mp version. Check if a new version of the plugin was released, or try to contact its creator and point him to this topic.
Reply
#9

Ok, thx for information. I'll try to do it.

Edit: That was my libMYSQL.dll problem.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)