Нафаня
Ученик
Привет всем, как мне можно сделать спавн транспорта из статических координат, тоесть когда в таблице vehicles нет транспорта то оно создаёт транспорты. Это я сделал, но проблема спавна транспорта с разными значениями.
У меня 2 раза создаётся один и тот транспорта с теми же значениями. А мне нужно чтобы создавался транспорта с значениями из массивов.
C:
enum SETVEHICLES_INFO
{
vid[2],
vehid[2],
Float:posx[2],
Float:posy[2],
Float:posz[2],
Float:posa[2],
};
static const Float:positionVehiclesX[] = {
-230.0, 650.0
};
static const Float:positionVehiclesY[] = {
2598.0, 1714.0
};
static const Float:positionVehiclesZ[] = {
62.0, 6.0
};
static const Float:positionVehiclesA[] = {
226.0, 348.0
};
static const VehiclesID[] = {
401, 422
};
// Здесь есть статические координаты
publics: CreateVehicles()
{
for(new a; a < 2; a++) {
for(new i = 0; i < sizeof(positionVehiclesX); i++) {
setVehicles_info[posx][a] = positionVehiclesX[i];
}
for(new i = 0; i < sizeof(positionVehiclesY); i++) {
setVehicles_info[posy][a] = positionVehiclesY[i];
}
for(new i = 0; i < sizeof(positionVehiclesZ); i++) {
setVehicles_info[posz][a] = positionVehiclesZ[i];
}
for(new i = 0; i < sizeof(positionVehiclesA); i++) {
setVehicles_info[posa][a] = positionVehiclesA[i];
}
for(new i = 0; i < sizeof(VehiclesID); i++) {
setVehicles_info[vehid][a] = VehiclesID[i];
}
CreateVehicle(setVehicles_info[vehid][a], setVehicles_info[posx][a], setVehicles_info[posy][a], setVehicles_info[posz][a], setVehicles_info[posa][a], 1, 1, -1);
query[0] = EOS;
mysql_format(connect_mysql, query, sizeof(query), "INSERT INTO `vehicles` (`posx`, `posy`, `posz`, `posa`, `vehid`) VALUES ('%f', '%f', '%f', '%f', '%d')", setVehicles_info[posx][a], setVehicles_info[posy][a], setVehicles_info[posz][a], setVehicles_info[posa][a], setVehicles_info[vehid][a]);
mysql_tquery(connect_mysql, query);
}
}
