01.03.2014, 19:27
Bueno, estoy intentando hacer un sistema de vehiculos pero algo ocurre en el codigo o la conexion que no carga los vehiculos, tengo 1 vehiculo en la base de datos y no lo carga.
les dejo los codigos.
les dejo los codigos.
pawn Код:
forward CargarAutos(resultid, extraid, ConnectionHandle);
public CargarAutos(resultid, extraid, ConnectionHandle)
{
new Rows, Field;
if(resultid != 0)
{
cache_get_data(Rows, Field);
}
switch(resultid)
{
case 3:
{
cache_get_data(Rows,Field, Conecction);
for( new i = 0; i < Rows; i++ )
{
if(i >= 3) {
print("Se ha alcanzado el mбximo de vehiculos para cargar");
break; }
new content[12];
cache_get_field_content(0, "propietario", VehiculosInfo[i][vpropietario]);
cache_get_field_content(0, "precio", content); VehiculosInfo[i][vprecio] = strval(content);
cache_get_field_content(0, "modelo", content); VehiculosInfo[i][vmodelo] = strval(content);
cache_get_field_content(0, "x", content); VehiculosInfo[i][vx] = floatstr(content);
cache_get_field_content(0, "y", content); VehiculosInfo[i][vy] = floatstr(content);
cache_get_field_content(0, "z", content); VehiculosInfo[i][vz] = floatstr(content);
cache_get_field_content(0, "a", content); VehiculosInfo[i][va] = floatstr(content);
cache_get_field_content(0, "color1", content); VehiculosInfo[i][vcolor1] = strval(content);
cache_get_field_content(0, "color2", content); VehiculosInfo[i][vcolor2] = strval(content);
cache_get_field_content(0, "comprable", content); VehiculosInfo[i][vcomprable] = strval(content);
VehiculosInfo[i][vID] = i;
CreateVehicle(VehiculosInfo[i][vmodelo], VehiculosInfo[i][vx], VehiculosInfo[i][vy], VehiculosInfo[i][vz], VehiculosInfo[i][va], VehiculosInfo[i][vcolor1], VehiculosInfo[i][vcolor2], 5000);
new stringinfovehiculo2[61];
printf("creado vehiculo modelo: %d", VehiculosInfo[i][vmodelo]);
if(VehiculosInfo[i][vcomprable] == 1)
{
printf("[Vehiculos] Se ha cargado el auto N°%d. Tipo: Comprable", i);
if(!strcmp("nadie",VehiculosInfo[i][vpropietario],true))
{
new Text3D:infovehiculo,string[256];
format(string, sizeof(string), "{F6FF00}VEHНCULO EN VENTA\n{FFFFFF}Precio: $%d\nID: %d", VehiculosInfo[i][vprecio], VehiculosInfo[i][vID]);
infovehiculo = Create3DTextLabel(string, 0xFF0000AA, 0.0, 0.0, 0.0, 50.0, 0, 1);
Attach3DTextLabelToVehicle(infovehiculo,VehiculosInfo[i][vID], 0.0, 0.0, 0.5);
}
else
{
new Text3D:infovehiculo;
format(stringinfovehiculo2, sizeof(stringinfovehiculo2), "{F6FF00}Dueсo: %s\n{FFFFFF}ID: %d", VehiculosInfo[i][vpropietario], VehiculosInfo[i][vID]);
infovehiculo = Create3DTextLabel( stringinfovehiculo2, 0xFF0000AA, 0.0, 0.0, 0.0, 50.0, 0, 1 );
Attach3DTextLabelToVehicle( infovehiculo, VehiculosInfo[i][vID], 0.0, 0.0, 0.5);
}
} else printf("[Vehiculos] Se ha cargado el auto N°%d. Tipo: No Comprable", i);
Vehiculos_Creados++;
}
printf("[Vehiculos] Se han cargado %d vehiculos", Vehiculos_Creados++);
}
}
return 1;
}
pawn Код:
forward CargarVehiculos();
public CargarVehiculos()
{
new Query[256];
format(Query, sizeof(Query), "SELECT * FROM `vehicles`");
mysql_function_query(Conecction, Query, true, "CargarAutos", "i",3);
return 1;
}
pawn Код:
public OngameModeInit()
{
CargarVehiculos();
return 1;
}