attach objects to vehicles
#1

0.3c brings new function - AttachObjectToVehicle. This is a powerful and handy function. With this you can do stuff like:



or



But getting coordinates for this based on car origin is difficult.

BUT to make this easier, gtab the sa map editor here: https://sampforum.blast.hk/showthread.php?tid=139409

Then the procedure is simple:

- Add a vehicle ide number to the map
- Place it at coordinates 0,0,0 with no rotation
- Move camera to it (use views tab - point camera here option)
- Remove the piece of ground that is in the way there
- Now add objects as you would want them on the car, click show code option and you get this - examples:

Код:
DFT examples: 

// side ramps option:
CreateObject(3078, -1.48, -1.68, 0.71,   -90.00, -90.00, 0.00);
CreateObject(3078, 1.50, -1.72, 0.71,   -90.00, -90.00, 0.00);

// blue open cargo crate (you can also use the other 3 cargo container ids - 2932, 2934, 2935)
CreateObject(3043, -0.01, -2.06, 1.20,   0.00, 0.00, 0.00);
						
// lion cage option
CreateObject(2909, -1.37, -1.75, 0.95,   0.00, 0.00, 0.00);
CreateObject(2909, 1.43, -1.75, 0.95,   0.00, 0.00, 0.00);
CreateObject(2909, 0.02, -1.77, 2.19,   0.00, -90.00, 0.00);
CreateObject(2904, 0.02, -5.62, 0.98,   0.00, 90.00, 0.00);
You can now use the coordinates and angles exported directly for AttachObjectToVehicle.
Reply
#2

Awesome!
Reply
#3

Thanks, but I don't get it at all video tutorial pl0x?
Reply
#4



pawn Код:
CreateObject(3786, 1.590000, -0.200000, -0.529999, 0.000000, 0.000000,  270.000000  );
CreateObject(3786, 2.899999, -0.579999, -0.529999, 0.000000, 0.000000,  270.000000  );
CreateObject(3786, 3.839998, -1.100000, -0.569999, 0.000000, 0.000000,  270.000000  );

CreateObject(3786, -1.590000, -0.200000, -0.529999, 0.000000, 0.000000, 270.000000 );
CreateObject(3786, -2.899999, -0.579999, -0.529999, 0.000000, 0.000000, 270.000000 );
CreateObject(3786, -3.839998, -1.100000, -0.569999, 0.000000, 0.000000, 270.000000 );
       
CreateObject(3790, 4.589999, -1.400000, -0.500000, 0.000000, 0.000000,   270.000000  );
CreateObject(3790, -4.589999, -1.400000, -0.500000, 0.000000, 0.000000,  270.000000 );
Reply
#5

@Blewert, awe, awe, awe, awe, awesome.
Reply
#6

Awesome.
Reply
#7

For a ramp behind the DFT-30 to get up onto it

pawn Код:
CreateObject ( 1633, 0, -8.8, -1.5, 0, 0, 0 );
Reply
#8

Nice truck .
Reply
#9

This is epic. Good job!
Reply
#10

hello,

the great photo, but it is very much to your establishment but its not explain how to create a vehicle with this object is attached above!

or moin how once we have our lines createobject (19420 ....)

we must do what with

Can someone help me thank you in advance
Reply
#11

This is so annoying!!! You explained nothing! Tell us how to do it in detail!!! For example what if we don't want the vehicle at 0, 0 ,0!!!!!! How would we move it and what about the objects Please this is making me mad!

new objectid = CreateObject(10245, 0.03029, 1.61068, 6.47431, 0.00000, 0.00000, 314.67206);
new vehicleid = 433;
AttachObjectToVehicle(objectid, vehicleid, -540.9130, -497.3527, 26.0530, 0.0000, 0.0000, 0.0000);

where must I put this? In what function!!! And what's wrong with it! I don't get errors but for example must the objects coords be the same as the vehicles?? And WTF must go by the attachobjectovehicle? Must it be the cars coords?? Or the objects?? WTF must I do, do the script for me, heres the vehicle where I want it placed: CreateVehicle(433, -540.9130, -497.3527, 26.0530, 0.0000, -1, -1, 100);
and heres my object: CreateObject(10245, 0.03029, 1.61068, 6.47431, 0.00000, 0.00000, 314.67206);
I placed the object at 0, 0, 0 coords. Now do it for me so I can see please:con fused:
Reply
#12

Quote:
Originally Posted by Mennims
Посмотреть сообщение
This is so annoying!!! You explained nothing! Tell us how to do it in detail!!! For example what if we don't want the vehicle at 0, 0 ,0!!!!!! How would we move it and what about the objects Please this is making me mad!

new objectid = CreateObject(10245, 0.03029, 1.61068, 6.47431, 0.00000, 0.00000, 314.67206);
new vehicleid = 433;
AttachObjectToVehicle(objectid, vehicleid, -540.9130, -497.3527, 26.0530, 0.0000, 0.0000, 0.0000);

where must I put this? In what function!!! And what's wrong with it! I don't get errors but for example must the objects coords be the same as the vehicles?? And WTF must go by the attachobjectovehicle? Must it be the cars coords?? Or the objects?? WTF must I do, do the script for me, heres the vehicle where I want it placed: CreateVehicle(433, -540.9130, -497.3527, 26.0530, 0.0000, -1, -1, 100);
and heres my object: CreateObject(10245, 0.03029, 1.61068, 6.47431, 0.00000, 0.00000, 314.67206);
I placed the object at 0, 0, 0 coords. Now do it for me so I can see please:con fused:
and you post on a 2 year old fucking thread -_-
Reply
#13

Well should I have started a new fucking thread so that it can die again? Please answer the question if you can
Reply
#14

Can anyone give me a little code of how to make the DFT-30 have two side walls and a ramp that slides down with /dftramp or something?
Reply
#15

wow great idea!
It was very easy now, thanks
Reply
#16

I love this app
Reply
#17

Forgot to post on here.

Really enjoy this method, makes attaching objects a breeze.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)