SA-MP Forums Archive
Doesn't attach object to vehicle - 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: Doesn't attach object to vehicle (/showthread.php?tid=445448)



Doesn't attach object to vehicle - ivanVU - 21.06.2013

I was trying to attach submarine to small boat and it doesn't work.

OnGameModeInit
Код:
	sub[0] = AddStaticVehicle(473, 391.2693, 337.8383, -0.0889, 37.0974, 1, 5); // Podmornica 1
	sub[1] = AddStaticVehicle(473, 375.7180, 324.6970, -0.1708, 31.9929, 1, 5); // Podmornica 2

	submarine[0] = CreateDynamicObject( 1612, 0, 0, 0, 0, 0, 0, 80 );
	submarine[1] = CreateDynamicObject( 1612, 0, 0, 0, 0, 0, 0, 80 );

	AttachObjectToVehicle( submarine[0], sub[0], 0.299999, -22.800050, 3.699998, 0.000000, 0.000000, 0.000000 );
	AttachObjectToVehicle( submarine[1], sub[1], 0.299999, -22.800050, 3.699998, 0.000000, 0.000000, 0.000000 );



Re: Doesn't attach object to vehicle - Goldilox - 21.06.2013

Can we not make it array but simple sub1 and sub2 ?


Re: Doesn't attach object to vehicle - Pottus - 21.06.2013

Wrong function you need this one.

pawn Код:
native AttachDynamicObjectToVehicle(objectid, vehicleid, Float:offsetx, Float:offsety, Float:offsetz, Float:rx, Float:ry, Float:rz);



Re: Doesn't attach object to vehicle - ivanVU - 22.06.2013

I've tried with AttachDynamicObjectToVehicle, and now it look's like this

Код:
	sub[0] = AddStaticVehicle(473, 391.2693, 337.8383, -0.0889, 37.0974, 1, 5); // Podmornica 1
	sub[1] = AddStaticVehicle(473, 375.7180, 324.6970, -0.1708, 31.9929, 1, 5); // Podmornica 2

	submarine = CreateDynamicObject( 1612, 0, 0, 0, 0, 0, 0, 80 );
	submarine1 = CreateDynamicObject( 1612, 0, 0, 0, 0, 0, 0, 80 );

	AttachDynamicObjectToVehicle( submarine, sub[0], 0.299999, -22.800050, 3.699998, 0.000000, 0.000000, 0.000000 );
	AttachDynamicObjectToVehicle( submarine1, sub[1], 0.299999, -22.800050, 3.699998, 0.000000, 0.000000, 0.000000 );