}
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;
}
totalbuildings = 11;
mysql_query(sql);
mysql_store_result();
totalbuildings = mysql_fetch_int();
mysql_free_result();
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_fetch_row(row);
mysql_store_result();
totalbuildings = mysql_fetch_int();
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;
}
for (new idx=0; idx<totalbuildings; idx++)