SA-MP Forums Archive
Right, what the hell is wrong here - 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: Right, what the hell is wrong here (/showthread.php?tid=330637)



Right, what the hell is wrong here - Luis- - 02.04.2012

Hi, i've got a airline loading system which is completely the same as my other loading systems;
pawn Код:
enum aInfo
{
    aID,
    Float:aX,
    Float:aY,
    Float:aZ,
    aSkin,
    aRank1[50],
    aRank2[50],
    aRank3[50],
    aRank4[50],
    aRank5[50],
    aName[100],
    aFunds,
    aMOTD[128],
}
new AirportInfo[MAX_AIRLINES][aInfo];
new airlines;

stock LoadAirlines()
{
    mysql_query("SELECT * FROM `airlines`");
    mysql_store_result();
    new line[516];
    while(mysql_fetch_row_format(line)) {
        sscanf(line, "p<|>e<dfffds[50]s[50]s[50]s[50]s[50]s[100]ds[128]>", AirportInfo[airlines]);

        airlines++;
        printf("Airlines ID: %d", AirportInfo[airlines][aID]);
        print(line);
    }
    printf("Loaded Airlines: %d.", airlines);
    mysql_free_result();
    return 1;
}
I honestly have no idea. It's loading correctly, it's just not assigning the vars, as you can see i've set a little debug print, here it is;
Код:
[01:08:20] Airlines ID: 0
[01:08:20] 1|9.9|0|0|120|rank1|rank2|rank3|rank4|rank5|nametest|0|Default
[01:08:20] Airlines ID: 0
[01:08:20] 2|0|0|0|113|Test1|Test2|rank3|test4|rank5|Luis_Test|0|
[01:08:20] Loaded Airlines: 2.



Re: Right, what the hell is wrong here - TzAkS. - 02.04.2012

Try to save all data like ID X Y Z Skin..
Код:
new string[256];
while(mysql_retrieve_row()) {
mysql_fetch_field_row(string, "ID"); AirportInfo[airlines][aID] = strval(string);
mysql_fetch_field_row(string, "X"); AirportInfo[airlines][aX] = strval(string);
mysql_fetch_field_row(string, "Y"); AirportInfo[airlines][aY] = strval(string);
Do this for all and be sure that you have something to load from database.


Re: Right, what the hell is wrong here - Luis- - 02.04.2012

The point is is that I am using the exact same code to load the houses, cars etc and they work perfectly.


Re: Right, what the hell is wrong here - Luis- - 02.04.2012

Anyone help me?


Re: Right, what the hell is wrong here - Kyle - 02.04.2012

Change your information to something like
500,600,700,800,900

etc in the sql database and you can see where it's going wrong then.


Re: Right, what the hell is wrong here - Luis- - 02.04.2012

I've just done it and they're all getting loaded.


Re: Right, what the hell is wrong here - Luis- - 02.04.2012

Seriously, I need to get this fixed or actually find out whats causing it.


Re: Right, what the hell is wrong here - Jefff - 03.04.2012

What is wrong here? only 1 error is here
pawn Код:
airlines++;
printf("Airlines ID: %d", AirportInfo[airlines][aID]);
should be
pawn Код:
printf("Airlines ID: %d", AirportInfo[airlines][aID]);
airlines++;



Re: Right, what the hell is wrong here - Luis- - 03.04.2012

Thanks! That seemed to have fixed it.


Re: Right, what the hell is wrong here - Luis- - 09.04.2012

It's started doing the bug again, I seriously have no idea what's wrong with it.