Crash on loading houses
#2

pawn Код:
LoadHouses()
{
    new Query[156], i; //(156 looks fine, for now, if u ever add more vars, print it and count the text length.)
    format(Query, sizeof(Query),"SELECT * FROM houses");
    mysql_query(Query);
    mysql_store_result();
    if(mysql_num_rows())
    {
        while(mysql_fetch_row(Query))
        {
            sscanf(Query, "d", i,
            HD[i][ID] = i;
            sscanf(Query, "ds[24]dffffffddddd", i,
            HD[i][owner],
            HD[i][price],
            HD[i][exteriorX],
            HD[i][exteriorY],
            HD[i][exteriorZ],
            HD[i][interiorX],
            HD[i][interiorY],
            HD[i][interiorZ],
            HD[i][interiorInt],
            HD[i][locked],
            HD[i][gunslot1],
            HD[i][locklevel],
            HD[i][safeamount]);

            if(strlen(HD[i][owner]) > 0) CreatePickup(1273, 1, HD[i][exteriorX], HD[i][exteriorY], HD[i][exteriorZ], -1);
            else CreatePickup(1272, 1, HD[i][exteriorX], HD[i][exteriorY], HD[i][exteriorZ], -1);
            printf("House %d created at x: %f, y: %f, z: %f, locklevel: %d", i, HD[i][exteriorX], HD[i][exteriorY], HD[i][exteriorZ], HD[i][locklevel]);
        }
    }
    else print("No houses to load!");
    print("House loading finished.");
    mysql_free_result();
    return 1;
}
lets see. due to people who know nothing.. (below) i will count the length you will probably need.

id..hmm lets use 4 chars
owner - 24
price - 11
ex - 9
ey - 9
ez - 9
ix - 9
iy - 9
iz - 9
iint - 11
locked - 11
gunslot1 - 11
locklevel - 11
safeamount - 11

around 158. and i doubt int,locked,gunslot,locklevel, will reach 11 integers. so 156 is good for now.
Reply


Messages In This Thread
Crash on loading houses - by Willow - 25.06.2011, 16:51
Re: Crash on loading houses - by Donya - 25.06.2011, 17:09
Re: Crash on loading houses - by Willow - 25.06.2011, 17:13
Re: Crash on loading houses - by GangsTa_ - 25.06.2011, 17:16
Re: Crash on loading houses - by Willow - 25.06.2011, 17:26
Re: Crash on loading houses - by Donya - 25.06.2011, 17:32
Re: Crash on loading houses - by Willow - 25.06.2011, 17:46
Re: Crash on loading houses - by Markx - 25.06.2011, 17:47
Re: Crash on loading houses - by Willow - 25.06.2011, 17:50
Re: Crash on loading houses - by Donya - 25.06.2011, 17:51

Forum Jump:


Users browsing this thread: 2 Guest(s)