First one, loads good, other not?
#1

Hey!

My login system is finished now (YES D).
And now i have a problem with the houses.
http://pastebin.com/tr1mMxzY
The first one, loads good (ID 0) the other loads not normal, everything 0.
Quote:

[00:38:40] houseid: 0, X: 1642.069946, Y: -2334.590087, Z: -2.679689, R: 185.807998, interior: 1, price: 1000, owner:
[00:38:40] houseid: 1, X: 0.000000, Y: 0.000000, Z: 0.000000, R: 0.000000, interior: 0, price: 0, owner:
[00:38:40] houseid: 2, X: 0.000000, Y: 0.000000, Z: 0.000000, R: 0.000000, interior: 0, price: 0, owner:

The /createhouse command works, in the database the pos, price are good.
I'am using this mysql plugin:
click
Wiki

Thanks...
Wouter!
Reply
#2

Well, like you I have a dynamic housing system, but I don't load houses this way. Here's how I do it:

Go to the top of your script and put:

new field[128][32];
new row[128];

Then put this at the bottom (I edited it for you):

pawn Код:
stock LoadHouses();
{
    new n,loading[50];
    for(new i=0; i<MAX_HOUSES; i++)
    {
        format(loading,sizeof(loading),"SELECT * FROM `houses` WHERE `id` < %d",i);
        mysql_query(loading);
        mysql_store_result();
        if(mysql_num_rows() == 0)
        {
            mysql_free_result();
            continue;
        }
        else
        {
            mysql_fetch_row_format(row, "|");
            explode(row, field, "|");
            i = strval(field[0]);
            Houses[i][house_x] = floatstr(field[1]);
            Houses[i][house_z] = floatstr(field[2]);
            Houses[i][house_z] = floatstr(field[3]);
            Houses[i][house_r] = floatstr(field[4]);
            Houses[i][house_interior] = strval(field[5]);
            Houses[i][house_price] = strval(field[6]);
            format(Houses[i][house_owner],25,"%s",field[7]);

            printf("houseid: %i, X: %f, Y: %f, Z: %f, R: %f, interior: %i, price: %i, owner: %s",

            i,
            Houses[i][house_x],
            Houses[i][house_y],
            Houses[i][house_z],
            Houses[i][house_r],
            Houses[i][house_interior],
            Houses[i][house_price],
            Houses[i][house_owner]);
            SPAWN_HOUSE(i);
            n++;
        }
        mysql_free_result();
        printf("%d houses loaded.", n);
    }
}
Reply
#3

Quote:

(1983) : error 017: undefined symbol "explode"

...,
Reply
#4

I forgot, here it is:

pawn Код:
explode(const sSource[], aExplode[][], const sDelimiter[] = " ", iVertices = sizeof aExplode, iLength = sizeof aExplode[]) // Created by Westie
{
    new
        iNode,
        iPointer,
        iPrevious = -1,
        iDelimiter = strlen(sDelimiter);

    while(iNode < iVertices)
    {
        iPointer = strfind(sSource, sDelimiter, false, iPointer);

        if(iPointer == -1)
        {
            strmid(aExplode[iNode], sSource, iPrevious, strlen(sSource), iLength);
            break;
        }
        else
        {
            strmid(aExplode[iNode], sSource, iPrevious, iPointer, iLength);
        }

        iPrevious = (iPointer += iDelimiter);
        ++iNode;
    }
    return iPrevious;
}
Reply
#5

Log deleted
Reply
#6

First, remove the log, it's long enough. Use this:

pawn Код:
stock LoadHouses();
{
    new n,loading[50];
    for(new i=0; i<MAX_HOUSES; i++)
    {
        format(loading,sizeof(loading),"SELECT * FROM `houses` WHERE `id` = %d",i);
        mysql_query(loading);
        mysql_store_result();
        if(mysql_num_rows() == 0)
        {
            mysql_free_result();
            continue;
        }
        if(mysql_num_rows() != 0)
        {
            mysql_fetch_row_format(row, "|");
            explode(row, field, "|");
            i = strval(field[0]);
            Houses[i][house_x] = floatstr(field[1]);
            Houses[i][house_z] = floatstr(field[2]);
            Houses[i][house_z] = floatstr(field[3]);
            Houses[i][house_r] = floatstr(field[4]);
            Houses[i][house_interior] = strval(field[5]);
            Houses[i][house_price] = strval(field[6]);
            format(Houses[i][house_owner],25,"%s",field[7]);

            printf("houseid: %i, X: %f, Y: %f, Z: %f, R: %f, interior: %i, price: %i, owner: %s",

            i,
            Houses[i][house_x],
            Houses[i][house_y],
            Houses[i][house_z],
            Houses[i][house_r],
            Houses[i][house_interior],
            Houses[i][house_price],
            Houses[i][house_owner]);
            SPAWN_HOUSE(i);
            n++;
        }
        mysql_free_result();
        printf("%d houses loaded.", n);
    }
}
Reply
#7

Next time use pastebin or something to post the log..
Reply
#8

Hmm, yea.
Good idea, sorry :$

Fixed! THANKS
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)