26.06.2016, 12:32
Well, I'm trying to load vehicles with the code below but it's not working, it seeming to me all is correct
Код:
public OnGameModeInit()
{
mysql_function_query(g_iHandle, "SELECT * FROM `srv_cars`", true, "LoadCarSystem", "");
}
Код:
public LoadCarSystem()
{
static
rows,
fields,
str[128];
cache_get_data(rows, fields, g_iHandle);
for (new i = 0; i < rows; i ++) if (i < MAX_VEHICLES)
{
CarSystem[i][cCarID] = cache_get_field_int(i, "CarID");
CarSystem[i][cModel] = cache_get_field_int(i, "Model");
CarSystem[i][cEssence] = cache_get_field_int(i, "Essence");
cache_get_row(i, 1, CarSystem[i][cX], g_iHandle, 128 );
cache_get_row(i, 1, CarSystem[i][cY], g_iHandle, 128 );
cache_get_row(i, 1, CarSystem[i][cZ], g_iHandle, 128 );
cache_get_row(i, 1, CarSystem[i][cAngle], g_iHandle, 128 );
CarSystem[i][cColor1] = cache_get_field_int(i, "Color1");
CarSystem[i][cColor2] = cache_get_field_int(i, "Color2");
CarSystem[i][cKM] = cache_get_field_int(i, "KM");
CarSystem[i][cObjective] = cache_get_field_int(i, "Objective");
CarSystem[i][cDoorsLocked] = cache_get_field_int(i, "DoorsLocked");
CarSystem[i][cVehicleType] = cache_get_field_int(i, "VehicleType");
cache_get_field_content(i, "Plaque", CarSystem[i][cPlaque], g_iHandle, 32);
CarSystem[i][cVehicleMaterials] = cache_get_field_int(i, "VehicleMaterials");
CarSystem[i][cVehicleCrack] = cache_get_field_int(i, "VehicleCrack");
CarSystem[i][cVehiclePot] = cache_get_field_int(i, "VehiclePot");
CarSystem[i][cJantes] = cache_get_field_int(i, "Jantes");
CarSystem[i][cMetre] = cache_get_field_int(i, "Metre");
CarSystem[i][cVehicleHealth] = cache_get_field_int(i, "VehicleHealth");
CarSystem[i][cVehicleAlarm] = cache_get_field_int(i, "VehicleAlarm");
CarSystem[i][cVehicleOwned] = cache_get_field_int(i, "VehicleOwned");
CarSystem[i][cDescription] = cache_get_field_int(i, "Description");
cache_get_field_content(i, "Owner", CarSystem[i][cOwner], g_iHandle, 32);
CarSystem[i][cNitro] = cache_get_field_int(i, "Nitro");
CarSystem[i][cPaintJob] = cache_get_field_int(i, "PaintJob");
CarSystem[i][cLoad] = cache_get_field_int(i, "Load");
CarSystem[i][cVehINT] = cache_get_field_int(i, "VehINT");
CarSystem[i][cVehWorld] = cache_get_field_int(i, "VehWorld");
CarSystem[i][cHydro] = cache_get_field_int(i, "Hydro");
CarSystem[i][cPimped] = cache_get_field_int(i, "Pimped");
CarSystem[i][cPerma] = cache_get_field_int(i, "Perma");
CarSystem[i][cRank] = cache_get_field_int(i, "Rank");
CarSystem[i][cPrice] = cache_get_field_int(i, "Price");
CarSystem[i][cSpoiler] = cache_get_field_int(i, "Spoiler");
CarSystem[i][cFbumper] = cache_get_field_int(i, "Fbumper");
CarSystem[i][cRbumper] = cache_get_field_int(i, "Rbumper");
SetVehicleHealth(i,CarSystem[i][cVehicleHealth]);
ChangeVehicleColor(i,CarSystem[i][cColor1], CarSystem[i][cColor2]);
ChangeVehiclePaintjob(i,CarSystem[i][cPaintJob]);
SetVehicleNumberPlate(i,CarSystem[i][cPlaque]);
AddVehicleComponent(i,CarSystem[i][cJantes]);
CreateVehicle(CarSystem[i][cModel],CarSystem[i][cX],CarSystem[i][cY],CarSystem[i][cZ],CarSystem[i][cAngle],CarSystem[i][cColor1],CarSystem[i][cColor2], -1);
}
printf("Loading Vehicles");
return 1;
}


.
