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; }
Please be more detailed.
Is there any vehicle (from those in db) in-game? Does the message "Loading Vehicles" appear in the console? Is it because the number of vehicle models is 0? That's nothing to concern because you have to keep in mind that there's delay while selecting the data, retrieving the data using cache functions and creating the vehicles. |
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 );
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"); CarSystem[i][cX] = cache_get_field_float(i, "PosX"); CarSystem[i][cY] = cache_get_field_float(i, "PosY"); CarSystem[i][cZ] = cache_get_field_float(i, "PosZ"); CarSystem[i][cAngle] = cache_get_field_float(i, "Angle"); 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"); cache_get_field_content(i, "Description", CarSystem[i][cDescription], g_iHandle, 64); cache_get_field_content(i, "Owner", CarSystem[i][cOwner], g_iHandle, 255); 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); } return 1; }