SA-MP Forums Archive
attach objects to vehicles - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: attach objects to vehicles (/showthread.php?tid=206939)



attach objects to vehicles - JernejL - 04.01.2011

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.


Re: attach objects to vehicles - Potassium - 04.01.2011

Awesome!


Re: attach objects to vehicles - Retardedwolf - 04.01.2011

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


Re: attach objects to vehicles - blewert - 04.01.2011



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



Re: attach objects to vehicles - Retardedwolf - 05.01.2011

@Blewert, awe, awe, awe, awe, awesome.


Re: attach objects to vehicles - HyperZ - 05.01.2011

Awesome.


Re: attach objects to vehicles - Retardedwolf - 05.01.2011

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

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



Re: attach objects to vehicles - davve95 - 12.01.2011

Nice truck .


Re: attach objects to vehicles - Infamous - 12.01.2011

This is epic. Good job!


Re : attach objects to vehicles - XBOGTA - 09.12.2012

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


Re: attach objects to vehicles - Mennims - 26.06.2013

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:


Re: attach objects to vehicles - OpticKiller - 26.06.2013

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 -_-


Re: attach objects to vehicles - Mennims - 26.06.2013

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


Re: attach objects to vehicles - Darnell - 29.07.2013

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?


Re: attach objects to vehicles - Cebo - 11.02.2014

wow great idea!
It was very easy now, thanks


Re: attach objects to vehicles - MpK - 25.04.2014

I love this app


Re: attach objects to vehicles - Ari - 01.01.2015

Forgot to post on here.

Really enjoy this method, makes attaching objects a breeze.