SA-MP Forums Archive
DetachTrailerFromVehicle - 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: DetachTrailerFromVehicle (/showthread.php?tid=661611)



DetachTrailerFromVehicle - m4karow - 09.12.2018

Hey

How I could detach a trailer from Baggage? I tried to attach the trailer to the vehicle before detaching but it's still connected to the vehicle... I think this is a bug, becouse I hear the sound of the detaching, but the trailer is too close to the beggae and it's get connected again. How I can fix this without changing the trailer position?


Re: DetachTrailerFromVehicle - Kraeror - 09.12.2018

can you show me your attach and detach code?


Re: DetachTrailerFromVehicle - m4karow - 09.12.2018

Quote:
Originally Posted by Kraeror
Посмотреть сообщение
can you show me your attach and detach code?
Код:
	new trailerid = GetVehicleTrailer(vehicleid);
	AttachTrailerToVehicle(trailerid, vehicleid);
	DetachTrailerFromVehicle(vehicleid);
It's working with the trucks and the trailers but don't work with the baggage and the 606, 607 (maybe 608 too) trailers


Re: DetachTrailerFromVehicle - Kraeror - 09.12.2018

What vehicle you want to connect to the 606,607 trailers?


Re: DetachTrailerFromVehicle - m4karow - 09.12.2018

Quote:
Originally Posted by Kraeror
Посмотреть сообщение
What vehicle you want to connect to the 606,607 trailers?



Re: DetachTrailerFromVehicle - Kraeror - 09.12.2018

show me the code where you are creating the vehicle and the trailer!


Re: DetachTrailerFromVehicle - m4karow - 09.12.2018

Quote:
Originally Posted by Kraeror
Посмотреть сообщение
show me the code where you are creating the vehicle and the trailer!
Why? I have to create the trailers as static vehicles? Why does it matter?


Re: DetachTrailerFromVehicle - Kraeror - 09.12.2018

Quote:
Originally Posted by m4karow
Посмотреть сообщение
Why? I have to create the trailers as static vehicles? Why does it matter?
because I can see the variable "trailerid" equals to GetVehicleTrailer and that means you have already attached a trailer to the vehicle, because this functions "gets the ID of the trailer attached to a vehicle".
I think trailerid has to equal to CreateVehicle(606...);, I'm not sure because I don't have the other code (where are created vehicles, trailers and etc.)


Re: DetachTrailerFromVehicle - m4karow - 09.12.2018

No, the values are correct.

Код:
	new trailerid = GetVehicleTrailer(vehicleid);
	DetachTrailerFromVehicle(vehicleid);

	new Float:X, Float:Y, Float:Z;
	GetVehiclePos(trailerid, X, Y, Z);
	SetVehiclePos(trailerid, X + 1, Y, Z);
As I said the problem is the trailer is too close to the vehicle and whenever I detached it, it's got connected again. This solve this problem.

Anyway, thanks for your reply.