13.07.2009, 20:41
Hi
I finally got the MySQL server working and I've entered all buildings' coords into the database.
Now I need some help making a function that can load them from the database.
I need to fetch row 0 to 39 from the database and then assign the values to their respective variables ( BuildingInfo[idx][var] ).
I tried to look on the example filterscript, but I don't fully understand that ..
Hope someone can help.
I finally got the MySQL server working and I've entered all buildings' coords into the database.
Now I need some help making a function that can load them from the database.
I need to fetch row 0 to 39 from the database and then assign the values to their respective variables ( BuildingInfo[idx][var] ).
I tried to look on the example filterscript, but I don't fully understand that ..

Hope someone can help.
pawn Код:
#define MAX_BUILDINGS 39
enum bInfo
{
Float:x,
Float:y,
Float:z,
Float:a,
Float:int_x,
Float:int_y,
Float:int_z,
Float:int_a,
int_id,
btext[128]
};
new BuildingInfo[MAX_BUILDINGS][bInfo];
public LoadBuildings()
{
MySQLCheckConnection();
new idx;
while(idx < sizeof(BuildingInfo))
{
printf("Idx: %d", idx);
// What goes here? Something like this?
format(line, sizeof(line), "%d", idx);
samp_mysql_fetch_row(line);
samp_mysql_strtok(result, "|", line);
idx++; pickupamount++;
}
return 1;
}

