Накидал тут, может где то ошибки и есть:
В начало мода куда нибудь
PHP код:
enum e_GHETTO_DATA
{
Float: x_coordinate_west_side_gz,
Float: y_coordinate_south_side_gz,
Float: x_coordinate_east_side_gz,
Float: y_coordinate_north_side_gz,
fraction_id
}
PHP код:
new counter_gang_zones = 0;
new DataGhetto[120][e_GHETTO_DATA];
#define TABLE_GANG_ZONE_BAND "ghetto"
PHP код:
public OnGameModeInit()
{
// connect_id - id подключение, записывают в перееменную: connect_id = mysql_connect(ip_addreas, users, date_base, data_pase_password);
mysql_function_query(connect_id, "SELECT * FROM `"TABLE_GANG_ZONE_BAND"`", true, "CallBackLoadGangZoneBand", "");
}
PHP код:
forward CallBackLoadGangZoneBand();
public CallBackLoadGangZoneBand()
{
new rows, fields;
cache_get_data(rows, fields);
if(rows == 0)
return print("[Предупреждение][Загрузка GangZone]: В базе данных нет GangZones!");
if(rows != sizeof(DataGhetto))
return printf("[Предупреждение][Загрузка GangZone]: В базе данных больше зон[%d], чем в массиве DataGhetto[%d][e_GHETTO_DATA]!", rows, sizeof(DataGhetto));
// Судя прописывать название столцов с координатами
static const column_one_coordinates[] = !"x_coordinate_west_side_gz";
static const column_two_coordinates[] = !"y_coordinate_south_side_gz";
static const column_three_coordinates[] = !"x_coordinate_east_side_gz";
static const column_four_coordinates[] = !"y_coordinate_north_side_gz";
static const column_id_fraction[] = !"fraction_id";
for(new i = 0; i < sizeof(DataGhetto); i++)
{
DataGhetto[i][x_coordinate_west_side_gz] = cache_get_field_content_float(i, column_one_coordinates);
DataGhetto[i][y_coordinate_south_side_gz] = cache_get_field_content_float(i, column_two_coordinates);
DataGhetto[i][x_coordinate_east_side_gz] = cache_get_field_content_float(i, column_three_coordinates);
DataGhetto[i][y_coordinate_north_side_gz] = cache_get_field_content_float(i, column_four_coordinates);
DataGhetto[i][fraction_id] = cache_get_field_content_int(i, "column_id_fraction");
}
counter_gang_zones = rows;
printf("[Загрузка GangZone]: Загрузка GangZones прошла успешна! Загружено %d GangZone", counter_gang_zones);
return (rows == 0) ? 0 : 1;
}