Mr_Tigr
Дебютант
При загрузке машина должно появляться в интерьере и вирт.мире который записан в базе, но она спавниться все равно в 0, 0 интерьере и вирт.мире.
Код:
public: LoadOwnableCar(playerid, oc_id)
{
if(g_ownable_car_loaded + 1 > MAX_OWNABLE_CARS)
{
print("[OwnableCars]: Ioeaea a caa?ocea. I?aauoai eeieo ee?iiai o?ainii?oa (MAX_OWNABLE_CARS)");
return -1;
}
new query[55],
Cache: result,
vehicleid;
mysql_format(mysql, query, sizeof query, "SELECT * FROM ownable_cars WHERE id='%d' LIMIT 1", oc_id);
result = mysql_query(mysql, query, true);
new idx = GetFreeOwnableCarID();
SetOwnableCarData(idx, OC_SQL_ID, cache_get_field_content_int(0, "id"));
SetOwnableCarData(idx, OC_OWNER_ID, cache_get_field_content_int(0, "owner_id"));
SetOwnableCarData(idx, OC_MODEL_ID, cache_get_field_content_int(0, "model_id"));
SetOwnableCarData(idx, OC_COLOR_1, cache_get_field_content_int(0, "color_1"));
SetOwnableCarData(idx, OC_COLOR_2, cache_get_field_content_int(0, "color_2"));
SetOwnableCarData(idx, OC_VINIL, cache_get_field_content_int(0, "vinil"));
SetOwnableCarData(idx, OC_DISKI, cache_get_field_content_int(0, "diski"));
SetOwnableCarData(idx, OC_GIDRA, cache_get_field_content_int(0, "gidra"));
SetOwnableCarData(idx, OC_NITRO, cache_get_field_content_int(0, "nitro"));
SetOwnableCarData(idx, OC_ST_LOAD, 1);
SetVehicleData(idx, V_RENT, cache_get_field_content_int(0, "rent"));
SetVehicleData(idx, V_RENTP, cache_get_field_content_int(0, "rentp"));
SetOwnableCarData(idx, OC_POS_X, cache_get_field_content_float(0, "pos_x"));
SetOwnableCarData(idx, OC_POS_Y, cache_get_field_content_float(0, "pos_y"));
SetOwnableCarData(idx, OC_POS_Z, cache_get_field_content_float(0, "pos_z"));
SetOwnableCarData(idx, OC_ANGLE, cache_get_field_content_float(0, "angle"));
cache_get_field_content(0, "number", g_ownable_car[idx][OC_NUMBER], mysql, 8);
cache_get_field_content(0, "region", g_ownable_car[idx][OC_REGION], mysql, 4);
SetOwnableCarData(idx, OC_ALARM, bool: cache_get_field_content_int(0, "alarm"));
SetOwnableCarData(idx, OC_KEY_IN, bool: cache_get_field_content_int(0, "key_in"));
SetOwnableCarData(idx, OC_CREATE, cache_get_field_content_int(0, "create_time"));
SetOwnableCarData(idx, OC_NAGNET, cache_get_field_content_int(0, "NAGNET"));
SetOwnableCarData(idx, OC_TURB, cache_get_field_content_int(0, "TURB"));
SetOwnableCarData(idx, OC_RADIATOR, cache_get_field_content_int(0, "RADIATOR"));
SetOwnableCarData(idx, OC_KOLESO_1, cache_get_field_content_float(0, "koleso_1"));
SetOwnableCarData(idx, OC_KOLESO_2, cache_get_field_content_float(0, "koleso_2"));
SetOwnableCarData(idx, OC_KOLESO_3, cache_get_field_content_float(0, "koleso_3"));
SetOwnableCarData(idx, OC_KOLESO_4, cache_get_field_content_float(0, "koleso_4"));
SetOwnableCarData(idx, OC_OBVES_1, cache_get_field_content_int(0, "obves_1"));
SetOwnableCarData(idx, OC_OBVES_2, cache_get_field_content_int(0, "obves_2"));
SetOwnableCarData(idx, OC_OBVES_3, cache_get_field_content_int(0, "obves_3"));
SetOwnableCarData(idx, OC_OBVES_4, cache_get_field_content_int(0, "obves_4"));
SetOwnableCarData(idx, OC_OBVES_5, cache_get_field_content_int(0, "obves_5"));
SetOwnableCarData(idx, OC_OBVES_6, cache_get_field_content_int(0, "obves_6"));
SetOwnableCarData(idx, OC_OBVES_7, cache_get_field_content_int(0, "obves_7"));
SetOwnableCarData(idx, OC_OBVES_8, cache_get_field_content_int(0, "obves_8"));
SetOwnableCarData(idx, OC_OBVES_9, cache_get_field_content_int(0, "obves_9"));
SetOwnableCarData(idx, OC_OBVES_10, cache_get_field_content_int(0, "obves_10"));
SetOwnableCarData(idx, OC_OBVES_11, cache_get_field_content_int(0, "obves_11"));
SetOwnableCarData(idx, OC_OBVES_12, cache_get_field_content_int(0, "obves_12"));
SetOwnableCarData(idx, OC_OBVES_13, cache_get_field_content_int(0, "obves_13"));
SetOwnableCarData(idx, OC_OBVES_14, cache_get_field_content_int(0, "obves_14"));
SetOwnableCarData(idx, OC_INTER, cache_get_field_content_int(0, "inter"));
SetOwnableCarData(idx, OC_WORLD, cache_get_field_content_int(0, "world"));
// ----------------------------------------------------------------------------------------
if(strlen(GetOwnableCarData(idx, OC_NUMBER)) != 6)
strmid(g_ownable_car[idx][OC_NUMBER], "------", 0, 8, 8);
new sL_Slot = GetPVarInt(playerid, "listitem_car");
cars_g[playerid][sL_Slot] = CreateVehicle
(
GetOwnableCarData(idx, OC_MODEL_ID),
GetOwnableCarData(idx, OC_POS_X),
GetOwnableCarData(idx, OC_POS_Y),
GetOwnableCarData(idx, OC_POS_Z),
GetOwnableCarData(idx, OC_ANGLE),
GetOwnableCarData(idx, OC_COLOR_1),
GetOwnableCarData(idx, OC_COLOR_2),
-1,
0,
VEHICLE_ACTION_TYPE_OWNABLE_CAR,
idx
);
if(cars_g[playerid][sL_Slot] != INVALID_VEHICLE_ID)
{
SetVehicleParam(cars_g[playerid][sL_Slot], V_LOCK, VEHICLE_PARAM_OFF);
SetVehicleData(cars_g[playerid][sL_Slot], V_MILEAGE, cache_get_field_content_float(0, "mileage"));
SetVehicleTined(cars_g[playerid][sL_Slot],
0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
0, 0, 0, 0, 0);
SetVehicleTinedSQL(cars_g[playerid][sL_Slot]);
ChangeVehiclePaintjob(cars_g[playerid][sL_Slot], GetOwnableCarData(idx, OC_VINIL));
if(GetOwnableCarData(idx, OC_DISKI) != -1)
{
AddVehicleComponent(cars_g[playerid][sL_Slot], GetOwnableCarData(idx, OC_DISKI));
}
/*if(GetOwnableCarData(idx, OC_GIDRA) > 1)
{
AddVehicleComponent(cars_g[playerid][sL_Slot], GetOwnableCarData(idx, OC_GIDRA));
}
if(GetOwnableCarData(idx, OC_NITRO) > 1)
{
AddVehicleComponent(cars_g[playerid][sL_Slot], GetOwnableCarData(idx, OC_NITRO));
}*/
if(GetOwnableCarData(idx, OC_OBVES_1) != -1)
{
AddVehicleComponent(cars_g[playerid][sL_Slot], GetOwnableCarData(idx, OC_OBVES_1));
}
if(GetOwnableCarData(idx, OC_OBVES_2) != -1)
{
AddVehicleComponent(cars_g[playerid][sL_Slot], GetOwnableCarData(idx, OC_OBVES_2));
}
if(GetOwnableCarData(idx, OC_OBVES_3) != -1)
{
AddVehicleComponent(cars_g[playerid][sL_Slot], GetOwnableCarData(idx, OC_OBVES_3));
}
if(GetOwnableCarData(idx, OC_OBVES_4) != -1)
{
AddVehicleComponent(cars_g[playerid][sL_Slot], GetOwnableCarData(idx, OC_OBVES_4));
}
if(GetOwnableCarData(idx, OC_OBVES_5) != -1)
{
AddVehicleComponent(cars_g[playerid][sL_Slot], GetOwnableCarData(idx, OC_OBVES_5));
}
if(GetOwnableCarData(idx, OC_OBVES_6) != -1)
{
AddVehicleComponent(cars_g[playerid][sL_Slot], GetOwnableCarData(idx, OC_OBVES_6));
}
if(GetOwnableCarData(idx, OC_OBVES_7) != -1)
{
AddVehicleComponent(cars_g[playerid][sL_Slot], GetOwnableCarData(idx, OC_OBVES_7));
}
if(GetOwnableCarData(idx, OC_OBVES_8) != -1)
{
AddVehicleComponent(cars_g[playerid][sL_Slot], GetOwnableCarData(idx, OC_OBVES_8));
}
if(GetOwnableCarData(idx, OC_OBVES_9) != -1)
{
AddVehicleComponent(cars_g[playerid][sL_Slot], GetOwnableCarData(idx, OC_OBVES_9));
}
if(GetOwnableCarData(idx, OC_OBVES_10) != -1)
{
AddVehicleComponent(cars_g[playerid][sL_Slot], GetOwnableCarData(idx, OC_OBVES_10));
}
if(GetOwnableCarData(idx, OC_OBVES_11) != -1)
{
AddVehicleComponent(cars_g[playerid][sL_Slot], GetOwnableCarData(idx, OC_OBVES_11));
}
if(GetOwnableCarData(idx, OC_OBVES_12) != -1)
{
AddVehicleComponent(cars_g[playerid][sL_Slot], GetOwnableCarData(idx, OC_OBVES_12));
}
if(GetOwnableCarData(idx, OC_OBVES_13) != -1)
{
AddVehicleComponent(cars_g[playerid][sL_Slot], GetOwnableCarData(idx, OC_OBVES_13));
}
if(GetOwnableCarData(idx, OC_OBVES_14) != -1)
{
AddVehicleComponent(cars_g[playerid][sL_Slot], GetOwnableCarData(idx, OC_OBVES_14));
}
SetVehicleData(cars_g[playerid][sL_Slot], V_LAST_LOAD_TIME, gettime());
SetVehicleData(cars_g[playerid][sL_Slot], V_HEALTH, cache_get_field_content_float(0, "health"));
SetVehicleHealth(cars_g[playerid][sL_Slot], GetVehicleData(vehicleid, V_HEALTH));
LinkVehicleToInterior(cars_g[playerid][sL_Slot], cache_get_field_content_int(0, "inter"));
SetVehicleVirtualWorld(cars_g[playerid][sL_Slot], cache_get_field_content_int(0, "world"));
}
cache_delete(result);
LoadOwnableCarTrunk(cars_g[playerid][sL_Slot]);
return 1;
}
Последнее редактирование:
