Hello there. I am having difficulties with the AttachObjectToVehicle. I made some vehicles with the CreateVehicle function and named them. After that I made a function which called it PutObjects, created 6 same objects, used the aAttachObjectToVehicle function but they didn't appear in game. I also debugged, and the weird is that it printed all of them. I currently can't give any code, but I thought maybe you could give me an example of it. Thank you so much.
pawn Код:
new trucks[6];
public OnGameModeInit()
{
trucks[0] = AddStaticVehicleEx(528, -240.8612, 2595.5745, 62.5005, 3.5863, -1, -1, 100);
trucks[1] = AddStaticVehicleEx(528, -228.5592, 2609.6279, 62.5005, 359.2786, -1, -1, 100);
trucks[2] = AddStaticVehicleEx(528, -1530.9017, 2572.5398, 55.8458, 185.6059, -1, -1, 100);
trucks[3] = AddStaticVehicleEx(528, -1511.1667, 2570.7363, 55.8458, 119.5413, -1, -1, 100);
trucks[4] = AddStaticVehicleEx(528, -80.8397, 1177.3905, 19.5388, 70.3925, -1, -1, 100);
trucks[5] = AddStaticVehicleEx(528, -80.9141, 1167.0448, 19.5388, 27.5615, -1, -1, 100);
PutObjects();
return 1;
}
forward PutObjects();
public PutObjects()
{
printf("PutObjects loaded");
new myobject0 = CreateDynamicObject(3117,0,0,-1000,0,0,0,100);
new myobject1 = CreateDynamicObject(3117,0,0,-1000,0,0,0,100);
new myobject2 = CreateDynamicObject(3117,0,0,-1000,0,0,0,100);
new myobject3 = CreateDynamicObject(3117,0,0,-1000,0,0,0,100);
new myobject4 = CreateDynamicObject(3117,0,0,-1000,0,0,0,100);
new myobject5 = CreateDynamicObject(3117,0,0,-1000,0,0,0,100);
printf("Created 6 objects");
AttachDynamicObjectToVehicle(myobject0,trucks[0],0.000000,-3.675001,-0.524999,0.000000,0.000000,0.000000);
printf("Attached object to Truck 0");
AttachDynamicObjectToVehicle(myobject1,trucks[1],0.000000,-3.675001,-0.524999,0.000000,0.000000,0.000000);
printf("Attached object to Truck 1");
AttachDynamicObjectToVehicle(myobject2,trucks[2],0.000000,-3.675001,-0.524999,0.000000,0.000000,0.000000);
printf("Attached object to Truck 2");
AttachDynamicObjectToVehicle(myobject3,trucks[3],0.000000,-3.675001,-0.524999,0.000000,0.000000,0.000000);
printf("Attached object to Truck 3");
AttachDynamicObjectToVehicle(myobject4,trucks[4],0.000000,-3.675001,-0.524999,0.000000,0.000000,0.000000);
printf("Attached object to Truck 4");
AttachDynamicObjectToVehicle(myobject5,trucks[5],0.000000,-3.675001,-0.524999,0.000000,0.000000,0.000000);
printf("Attached object to Truck 5");
return 1;
}