db_get_field_assoc server crash.
#1

Server crash with this code :
pawn Код:
new Ext[5][180], Int[5][180], name[32], money[10], type[1];
        db_get_field_assoc(Result, "bOwner", BizInfo[idx][bOwner], MAX_PLAYER_NAME);
        db_get_field_assoc(Result, "bType", type, 1);
        db_get_field_assoc(Result, "bExtX", Ext[0], 10);
        db_get_field_assoc(Result, "bExtY", Ext[1], 10);
        db_get_field_assoc(Result, "bExtZ", Ext[2], 10);
        db_get_field_assoc(Result, "bExtInt", Ext[3], 10);
        db_get_field_assoc(Result, "bExtVW", Ext[4], 10);
        db_get_field_assoc(Result, "bIntX", Int[0], 10);
        db_get_field_assoc(Result, "bIntY", Int[1], 10);
        db_get_field_assoc(Result, "bIntZ", Int[2], 10);
        db_get_field_assoc(Result, "bIntInt", Int[3], 10);
        db_get_field_assoc(Result, "bIntVW", Int[4], 10);
        db_get_field_assoc(Result, "bName", name, 32);
        db_get_field_assoc(Result, "bMoney", money, 10);
crashdetect report :
Quote:

[21:45:21] [debug] Server crashed while executing DGRP.amx
[21:45:21] [debug] AMX backtrace:
[21:45:21] [debug] #0 native db_get_field_assoc () from samp-server.exe
[21:45:21] [debug] #1 0002aa9c in ?? () from DGRP.amx
[21:45:21] [debug] #2 0002c034 in public Itter_OnGameModeInit () from DGRP.amx
[21:45:21] [debug] #3 native CallLocalFunction () from samp-server.exe
[21:45:21] [debug] #4 00018904 in ?? () from DGRP.amx
[21:45:21] [debug] #5 0000c610 in public ScriptInit_OnGameModeInit () from DGRP.amx
[21:45:21] [debug] #6 00006e10 in public SSCANF_OnGameModeInit () from DGRP.amx
[21:45:21] [debug] #7 native CallLocalFunction () from samp-server.exe
[21:45:21] [debug] #8 000010e0 in public OnGameModeInit () from DGRP.amx
[21:45:22] [debug] Native backtrace:
[21:45:22] [debug] #0 0046ebf1 in ?? () from samp-server.exe
[21:45:22] [debug] #1 004010b6 in ?? () from samp-server.exe
[21:45:22] [debug] #2 666c0244 in ?? () from plugins\crashdetect.DLL
[21:45:22] [debug] #3 666c636a in ?? () from plugins\crashdetect.DLL
[21:45:22] [debug] #4 666c8bc8 in ?? () from plugins\crashdetect.DLL
[21:45:22] [debug] #5 666c0a57 in ?? () from plugins\crashdetect.DLL
[21:45:22] [debug] #6 666c63ba in ?? () from plugins\crashdetect.DLL
[21:45:22] [debug] #7 64364885 in ?? () from plugins\streamer.DLL
[21:45:22] [debug] #8 0047315e in ?? () from samp-server.exe
[21:45:22] [debug] #9 004010b6 in ?? () from samp-server.exe
[21:45:22] [debug] #10 666c0244 in ?? () from plugins\crashdetect.DLL
[21:45:22] [debug] #11 666c636a in ?? () from plugins\crashdetect.DLL
[21:45:22] [debug] #12 666c8bc8 in ?? () from plugins\crashdetect.DLL
[21:45:22] [debug] #13 666c0a57 in ?? () from plugins\crashdetect.DLL
[21:45:22] [debug] #14 666c63ba in ?? () from plugins\crashdetect.DLL
[21:45:22] [debug] #15 64364885 in ?? () from plugins\streamer.DLL
[21:45:22] [debug] #16 0047315e in ?? () from samp-server.exe
[21:45:22] [debug] #17 004010b6 in ?? () from samp-server.exe
[21:45:22] [debug] #18 666c0244 in ?? () from plugins\crashdetect.DLL
[21:45:22] [debug] #19 666c636a in ?? () from plugins\crashdetect.DLL
[21:45:22] [debug] #20 666c8bc8 in ?? () from plugins\crashdetect.DLL
[21:45:22] [debug] #21 666c0a57 in ?? () from plugins\crashdetect.DLL
[21:45:22] [debug] #22 666c63ba in ?? () from plugins\crashdetect.DLL
[21:45:22] [debug] #23 64364885 in ?? () from plugins\streamer.DLL
[21:45:22] [debug] #24 0046e924 in ?? () from samp-server.exe
[21:45:22] [debug] #25 65646f6d in ?? () from samp-server.exe
[21:45:22] [debug] #26 47442f73 in ?? () from samp-server.exe
[21:45:22] [debug] #27 612e5052 in ?? () from samp-server.exe

Reply
#2

You are using db_get_field_assoc wrong. You need to store the value it gives you in a string and then use floatstr or strval.

So if you want to load an integer:

Код:
new temp[32], myInt;
db_get_field_assoc(Result, "myInt", temp, sizeof(temp));
myInt = strval(temp);
For floats:

Код:
new temp[32], Float:myFloat;
db_get_field_assoc(Result, "myFloat", temp, sizeof(temp));
myFloat = floatstr(temp);
Reply
#3

As far as I know, Everything is correct in my code... for me :/
I have all in string, And then I actually convert them here :
pawn Код:
//Converting :
        BizInfo[idx][bType]   = strval(type);
        BizInfo[idx][bExtX]   = floatstr(Ext[0]);
        BizInfo[idx][bExtY]   = floatstr(Ext[1]);
        BizInfo[idx][bExtZ]   = floatstr(Ext[2]);
        BizInfo[idx][bExtInt] = strval(Ext[3]);
        BizInfo[idx][bExtVW]  = strval(Ext[4]);
        BizInfo[idx][bIntX]   = floatstr(Int[0]);
        BizInfo[idx][bIntY]   = floatstr(Int[1]);
        BizInfo[idx][bIntZ]   = floatstr(Int[2]);
        BizInfo[idx][bIntInt] = strval(Int[3]);
        BizInfo[idx][bIntVW]  = strval(Int[4]);
        BizInfo[idx][bName]   = strval(name);
        BizInfo[idx][bMoney]  = strval(money);
Reply
#4

I fixed it, The arrays "Int[5][10]" and "Ext[5][10]" weren't valid, And I had to declare a var for each one instead of an array.

If you can say how to make a string array ? It'd be great.

+REPed for being interested.

E: This wasn't the problem :P, One of the feilds was NULL in the DB which was causing it to crash...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)