MySQL
#1

I have building system on MySQL but the bulilding id 10 wont come in come and the script load 10 buildings

10 Buildings loaded from database

MySQL load

pawn Код:
}

forward LoadBuilding();
public LoadBuilding()
{
    new arrCoords[11][64];
    new sql[80], row[512];
    format(sql, sizeof(sql), "SELECT COUNT(*) FROM Buildings");
    mysql_query(sql);
    mysql_store_result();
    mysql_fetch_row(row);
    totalbuildings = 10;
    mysql_free_result();

    for (new idx=0; idx<totalbuildings; idx++)
    {
        format(sql, sizeof(sql), "SELECT * FROM Buildings WHERE BuildingID=%d", idx);
        mysql_query(sql);
        mysql_store_result();
        if (mysql_num_rows() > 0)
        {
            mysql_fetch_row(row);
            split(row, arrCoords, '|');
            mysql_free_result();
            Building[idx][EnterX] = floatstr(arrCoords[1]);
            Building[idx][EnterY] = floatstr(arrCoords[2]);
            Building[idx][EnterZ] = floatstr(arrCoords[3]);
            Building[idx][PickupID] = strval(arrCoords[4]);
            Building[idx][ExitX] = floatstr(arrCoords[5]);
            Building[idx][ExitY] = floatstr(arrCoords[6]);
            Building[idx][ExitZ] = floatstr(arrCoords[7]);
            strmid(Building[idx][BuildingName], arrCoords[8], 0, strlen(arrCoords[8]), 255);
            Building[idx][ExitInterior] = strval(arrCoords[9]);
            Building[idx][Custom] = strval(arrCoords[10]);

            //Building[idx][PickupID] = CreateStreamPickup(1239, 1, Building[idx][EnterX], Building[idx][EnterY], Building[idx][EnterZ],15);
            CreateDynamicPickup(1318, 1, Building[idx][EnterX], Building[idx][EnterY], Building[idx][EnterZ], -1, -1, -1, 40.0);
        }
    }
    mysql_free_result();
    printf("%d Buildings loaded from database", totalbuildings);
    return true;
}
Reply


Messages In This Thread
MySQL - by N0FeaR - 02.05.2012, 22:22
Re: MySQL - by WackoX - 02.05.2012, 22:27
Re: MySQL - by N0FeaR - 02.05.2012, 22:40
Re: MySQL - by MadeMan - 03.05.2012, 11:03
Re: MySQL - by N0FeaR - 03.05.2012, 11:14
Re: MySQL - by MadeMan - 03.05.2012, 11:17
Re: MySQL - by N0FeaR - 03.05.2012, 11:18
Re: MySQL - by Calgon - 03.05.2012, 11:21
Re: MySQL - by N0FeaR - 03.05.2012, 11:22
Re: MySQL - by MadeMan - 03.05.2012, 11:23

Forum Jump:


Users browsing this thread: 2 Guest(s)