20.09.2016, 18:00
Buenas, en la base de dato se guarda todo bien pero al momento de cargar los vehнculos aparecen en el mismo lugar y solo uno con el label de venta(para los vehнculso en venta), entonces estб cargando mal, solo carga 1 vehнculo bien y los demбs no, asн estб mi cargado, uso MYSQL R39-6
Код:
OnGamemode init CargarVehiculos... CALLBACK: CargarVehiculos() { mysql_function_query(MySQL, "SELECT * FROM vehiculos", true, "CargarAutosFuc_", ""); return 1; } CALLBACK: CargarAutosFuc_() { new rows, fields; cache_get_data(rows, fields); if(rows) { for(new v; v < rows; v ++) { new Contenido[30], string[190]; cache_get_field_content(0, "vPropietario", Contenido); format(InformacionVehiculo_[v][vPropietario], 25, "%s", Contenido); cache_get_field_content(0, "vMatricula", Contenido); format(InformacionVehiculo_[v][vMatricula], 30, "%s", Contenido); InformacionVehiculo_[v][vSQLID] = cache_get_field_content_int(0, "vSQLID"); InformacionVehiculo_[v][vModelo] = cache_get_field_content_int(0, "vModelo"); InformacionVehiculo_[v][vColor][0] = cache_get_field_content_int(0, "vColor1"); InformacionVehiculo_[v][vColor][1] = cache_get_field_content_int(0, "vColor2"); InformacionVehiculo_[v][vPrecio] = cache_get_field_content_int(0, "vPrecio"); InformacionVehiculo_[v][vMotor] = cache_get_field_content_int(0, "vMotor"); InformacionVehiculo_[v][vPos][0] = cache_get_field_content_float(0, "vPosX"); InformacionVehiculo_[v][vPos][1] = cache_get_field_content_float(0, "vPosY"); InformacionVehiculo_[v][vPos][2] = cache_get_field_content_float(0, "vPosZ"); InformacionVehiculo_[v][vAngle] = cache_get_field_content_float(0, "vAngle"); InformacionVehiculo_[v][vSpawn][0] = cache_get_field_content_float(0, "vSpawnX"); InformacionVehiculo_[v][vSpawn][1] = cache_get_field_content_float(0, "vSpawnY"); InformacionVehiculo_[v][vSpawn][2] = cache_get_field_content_float(0, "vSpawnZ"); InformacionVehiculo_[v][vSAngle] = cache_get_field_content_float(0, "vSAngle"); InformacionVehiculo_[v][vParking][0] = cache_get_field_content_float(0, "vParkingX"); InformacionVehiculo_[v][vParking][1] = cache_get_field_content_float(0, "vParkingY"); InformacionVehiculo_[v][vParking][2] = cache_get_field_content_float(0, "vParkingZ"); InformacionVehiculo_[v][vPAngle] = cache_get_field_content_float(0, "vPAngle"); InformacionVehiculo_[v][vVirtualWorld] = cache_get_field_content_int(0, "vVirtualWorld"); InformacionVehiculo_[v][vInterior] = cache_get_field_content_int(0, "vInterior"); InformacionVehiculo_[v][vEstado] = cache_get_field_content_int(0, "vEstado"); InformacionVehiculo_[v][vTipo] = cache_get_field_content_int(0, "vTipo"); InformacionVehiculo_[v][vCantidad] = cache_get_field_content_int(0, "vCantidad"); InformacionVehiculo_[v][vKilometros] = cache_get_field_content_float(0, "vKilometros"); InformacionVehiculo_[v][vPartes][0] = cache_get_field_content_int(0, "vPanels"); InformacionVehiculo_[v][vPartes][1] = cache_get_field_content_int(0, "vDoors"); InformacionVehiculo_[v][vPartes][2] = cache_get_field_content_int(0, "vLights"); InformacionVehiculo_[v][vPartes][3] = cache_get_field_content_int(0, "vTires"); InformacionVehiculo_[v][vDamage] = cache_get_field_content_float(0, "vDamage"); new CrearVehiculo; CrearVehiculo = CreateVehicle(InformacionVehiculo_[v][vModelo], InformacionVehiculo_[v][vPos][0], InformacionVehiculo_[v][vPos][1], InformacionVehiculo_[v][vPos][2], InformacionVehiculo_[v][vAngle], InformacionVehiculo_[v][vColor][0], InformacionVehiculo_[v][vColor][1], 600000); if(InformacionVehiculo_[v][vDamage] < 250){InformacionVehiculo_[v][vDamage] = 250;} else if(InformacionVehiculo_[v][vDamage] > 1000){InformacionVehiculo_[v][vDamage] = 1000;} UpdateVehicleDamageStatus(CrearVehiculo, InformacionVehiculo_[v][vPartes][0], InformacionVehiculo_[v][vPartes][1], InformacionVehiculo_[v][vPartes][2], InformacionVehiculo_[v][vPartes][3]); SetVehicleHealth(CrearVehiculo, InformacionVehiculo_[v][vDamage]), SetVehicleVirtualWorld(CrearVehiculo, InformacionVehiculo_[v][vVirtualWorld]); LinkVehicleToInteriorEx(CrearVehiculo, InformacionVehiculo_[v][vInterior]), TotalVehiculos = rows; if(InformacionVehiculo_[v][vEstado] == 1) { switch(InformacionVehiculo_[v][vTipo]) { case 0: { format(string, sizeof(string), ""#CAZUL"%s(N - ID 0%d)"#CBLANCO"\nPrecio: "#CVERDE_OSCURO"%s"#CBLANCO" - Stock: "#CROJO_2"%d/120\n\n"#CBLANCO"Ingresa "#CPIEL"/comprar vehiculo"#CBLANCO" para adquirir este vehнculo", NombreVehiculo_(InformacionVehiculo_[v][vModelo]), InformacionVehiculo_[v][vSQLID], FormatNumber(InformacionVehiculo_[v][vPrecio]), InformacionVehiculo_[v][vCantidad]); } case 1: { format(string, sizeof(string), ""#CAZUL"%s(P - ID 0%d)"#CBLANCO"\nPrecio: "#CVERDE_OSCURO"%s"#CBLANCO" - Stock: "#CROJO_2"%d/120\n\n"#CBLANCO"Ingresa "#CPIEL"/comprar vehiculo"#CBLANCO" para adquirir este vehнculo", NombreVehiculo_(InformacionVehiculo_[v][vModelo]), InformacionVehiculo_[v][vSQLID], FormatNumber(InformacionVehiculo_[v][vPrecio]), InformacionVehiculo_[v][vCantidad]); } } } InformacionVehiculo_[CrearVehiculo][vTexto] = CreateDynamic3DTextLabel(string, COLOR_AMARILLO, InformacionVehiculo_[v][vPos][0], InformacionVehiculo_[v][vPos][1], InformacionVehiculo_[v][vPos][2], 10.0); } printf("*- Se ha(n) cargado un total de %d vehiculo(s).", rows); } else if(!rows) { print("*- No se ha cargado ningъn vehнculo."); } return 1; }