Sqlite help.
#1

Alright. So the issue acquires when I log in, when I log in the server crashes. Like, instantly. I tried creating the loading function in a stock instead of the login dialog, still same shit.
I need help, asap.
pawn Код:
stock LoadAcc(playerid,password[])
{
    new Query[250],DBResult:Result;
    format(Query,sizeof(Query),"SELECT * FROM `users` WHERE `name` = '%s' COLLATE NOCASE AND `password` = '%s'",DB_Escape(GPN(playerid)),DB_Escape(password));
    Result = db_query(server,Query);
    if(db_num_rows(Result))
    {
        new Field[60];
        db_get_field_assoc(Result,"MONEY",Field,60);
        pInfo[Money][playerid] = strval(Field);
        GivePlayerMoney(playerid,pInfo[Money][playerid]);
           
        db_get_field_assoc(Result,"ADMINLEVEL",Field,60);
        pInfo[AdminLevel][playerid] = strval(Field);

        db_get_field_assoc(Result,"SCORE",Field,60);
        SetPlayerScore(playerid,strval(Field));

        db_get_field_assoc(Result,"X",Field,60);
        Pos[playerid][pX] = floatstr(Field);

        db_get_field_assoc(Result,"Y",Field,60);
        Pos[playerid][pY] = floatstr(Field);

        db_get_field_assoc(Result,"Z",Field,60);
        Pos[playerid][pZ] = floatstr(Field);

        db_get_field_assoc(Result,"SEX",Field,60);
        pInfo[Sex][playerid] = strval(Field);

        db_get_field_assoc(Result,"SKIN",Field,60);
        pInfo[Skin][playerid] = strval(Field);
        SetPlayerSkin(playerid,pInfo[Skin][playerid]);

        db_get_field_assoc(Result,"Type",Field,60);
        gTeam[playerid] = strval(Field);

        db_get_field_assoc(Result,"AGE",Field,60);
        pInfo[Age][playerid] = strval(Field);

        db_get_field_assoc(Result,"Primary",Field,60);
        pInfo[Primary][playerid] = strval(Field);

        db_get_field_assoc(Result,"pAmmo",Field,60);
        pInfo[pAmmo][playerid] = strval(Field);
        GiveWeapon(playerid,pInfo[Primary][playerid],pInfo[pAmmo][playerid]);

        db_get_field_assoc(Result,"Secondary",Field,60);
        pInfo[Secondary][playerid] = strval(Field);

        db_get_field_assoc(Result,"sAmmo",Field,60);
        pInfo[sAmmo][playerid] = strval(Field);
        GiveWeapon(playerid,pInfo[Secondary][playerid],pInfo[sAmmo][playerid]);
        printf("PLAYER %s SEX %i SKIN %i PRIMARY %i",GPN(playerid),pInfo[Skin][playerid],pInfo[Primary][playerid]);


        CheckBan(playerid);
        if(pInfo[Sex][playerid] == 0)
        {
            ShowPlayerDialog(playerid, 2, DIALOG_STYLE_MSGBOX,"What's your character's sex?","Please choose your character's sex below","Female","Male");
        }
    }
    else
    {
        ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"Login","Please type your password to proceed accessing your account!","Login","Quit");
        SendClientMessage(playerid,COLOR_RED,"ERROR: Wrong password!");

    }
    db_free_result(Result);
    return 1;
}
Reply
#2

Get Crash detect plugin from here https://sampforum.blast.hk/showthread.php?tid=262796
Compile the script in debug mode as mentioned here - http://forum.sa-mp.com/showpost.php?...32&postcount=7
And then run the script and check the server log it will give the line of error
Reply
#3

Looks like the wrong index is being used on your array structure.
pawn Код:
pInfo[Money][playerid]
//Isn't this supposed to be:
pInfo[playerid][Money]
Reply
#4

Код:
10:23:18] [debug] Server crashed while executing DM.amx
[10:23:18] [debug] AMX backtrace:
[10:23:18] [debug] #0 native db_get_field_assoc () from samp-server.exe
[10:23:18] [debug] #1 0000c3e0 in ?? (0, 85100) from DM.amx
[10:23:18] [debug] #2 00007764 in public OnDialogResponse (0, 1, 1, -1, 85100) from DM.amx
[10:23:18] [debug] Native backtrace:
[10:23:18] [debug] #0 0044dae1 in ?? () from samp-server.exe
[10:23:18] [debug] #1 004010b6 in ?? () from samp-server.exe
[10:23:18] [debug] #2 67a962ca in ?? () from plugins\crashdetect.DLL
[10:23:18] [debug] #3 67a98b28 in ?? () from plugins\crashdetect.DLL
[10:23:18] [debug] #4 67a909c7 in ?? () from plugins\crashdetect.DLL
[10:23:18] [debug] #5 67a9631a in ?? () from plugins\crashdetect.DLL
[10:23:18] [debug] #6 0046de11 in ?? () from samp-server.exe
[10:23:18] [debug] #7 00452970 in ?? () from samp-server.exe
[10:23:18] [debug] #8 77d6e003 in ?? () from C:\Windows\SysWOW64\ntdll.dll
[10:23:18] [debug] #9 75f714dd in ?? () from C:\Windows\syswow64\kernel32.dll
[10:23:18] [debug] #10 004a50fe in ?? () from samp-server.exe
[10:23:18] [debug] #11 68106ac3 in ?? () from samp-server.exe
[10:23:18] [debug] #12 004b3328 in ?? () from samp-server.exe
[10:23:19] [debug] Server crashed while executing DM.amx
[10:23:19] [debug] AMX backtrace:
[10:23:19] [debug] #0 native db_get_field_assoc () from samp-server.exe
[10:23:19] [debug] #1 0000c3e0 in ?? (0, 85100) from DM.amx
[10:23:19] [debug] #2 00007764 in public OnDialogResponse (0, 1, 1, -1, 85100) from DM.amx
[10:23:19] [debug] Native backtrace:
[10:23:19] [debug] #0 77d743b0 in ?? () from C:\Windows\SysWOW64\ntdll.dll
[10:23:19] [debug] #1 77d73587 in ?? () from C:\Windows\SysWOW64\ntdll.dll
[10:23:19] [debug] #2 77d73472 in ?? () from C:\Windows\SysWOW64\ntdll.dll
[10:23:19] [debug] #3 75f714dd in ?? () from C:\Windows\syswow64\kernel32.dll
[10:23:19] [debug] #4 00493bf1 in ?? () from samp-server.exe
[10:23:19] [debug] #5 0044e129 in ?? () from samp-server.exe
[10:23:19] [debug] #6 00458bcc in ?? () from samp-server.exe
[10:23:19] [debug] #7 0045b39a in ?? () from samp-server.exe
[10:23:19] [debug] #8 67a97c09 in ?? () from plugins\crashdetect.DLL
[10:23:19] [debug] #9 771e0816 in ?? () from C:\Windows\syswow64\KERNELBASE.dll
This is what I get.
EDIT:
Quote:
Originally Posted by Lordzy
Посмотреть сообщение
Looks like the wrong index is being used on your array structure.
pawn Код:
pInfo[Money][playerid]
//Isn't this supposed to be:
pInfo[playerid][Money]
No, I kinda switched those.
EDIT 2:
They work fine, like. It loads up to 2 or 3 things from the database, if I put more server crashes.
Reply
#5

pawn Код:
db_get_field_assoc(Result,"pAmmo",Field,60);
        pInfo[pAmmo][playerid] = strval(Field);
        GiveWeapon(playerid,pInfo[Primary][playerid],pInfo[pAmmo][playerid]);

        db_get_field_assoc(Result,"Secondary",Field,60);
        pInfo[Secondary][playerid] = strval(Field);

        db_get_field_assoc(Result,"sAmmo",Field,60);
        pInfo[sAmmo][playerid] = strval(Field);
        GiveWeapon(playerid,pInfo[Secondary][playerid],pInfo[sAmmo][playerid]);
So I did a simple debugging function, it did magic.
My GM crashes when those load..
EDIT:
Fixed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)