PDA

View Full Version : attach objects to vehicles


JernejL
04/01/2011, 10:46 PM
0.3c brings new function - AttachObjectToVehicle. This is a powerful and handy function. With this you can do stuff like:

http://mathpudding.com/topsecretsamp/DFT%20ramps.jpg

or

http://mathpudding.com/topsecretsamp/lioncage.jpg

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

BUT to make this easier, gtab the sa map editor here: http://forum.sa-mp.com/showthread.php?t=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.

Potassium
04/01/2011, 11:05 PM
Awesome!

Retardedwolf
04/01/2011, 11:12 PM
Thanks, but I don't get it at all video tutorial pl0x?

blewert
04/01/2011, 11:25 PM
http://i.imgur.com/iN656.png


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 );

Retardedwolf
05/01/2011, 05:55 AM
@Blewert, awe, awe, awe, awe, awesome.

HyperZ
05/01/2011, 08:04 AM
Awesome.

Retardedwolf
05/01/2011, 08:48 AM
For a ramp behind the DFT-30 to get up onto it

CreateObject ( 1633, 0, -8.8, -1.5, 0, 0, 0 );

davve95
12/01/2011, 02:54 PM
Nice truck :D.

Infamous
12/01/2011, 04:22 PM
This is epic. Good job!

XBOGTA
09/12/2012, 05:21 AM
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

Mennims
26/06/2013, 04:27 PM
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:confused::confused::confused::confused::con fused::mad::mad::mad:

OpticKiller
26/06/2013, 04:28 PM
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:confused::confused::confused::confused::con fused::mad::mad::mad:

and you post on a 2 year old fucking thread -_-

Mennims
26/06/2013, 07:16 PM
Well should I have started a new fucking thread so that it can die again? Please answer the question if you can

Darnell
29/07/2013, 02:10 PM
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?

Cebo
11/02/2014, 12:31 PM
wow great idea!
It was very easy now, thanks

MpK
25/04/2014, 11:52 AM
I love this app

Ari
01/01/2015, 09:17 AM
Forgot to post on here.

Really enjoy this method, makes attaching objects a breeze.