Jump to content

detachTrailerFromVehicle - Bug


[MRP] ProAiron

Recommended Posts

Dear community,

this is the first time that i post here but i am need to do this ^^ I'm austrian, but i don get answers in german boards.

I have the following problem:

I want to check the correct combination of a truck and trailer - for example i only allow a Petrol Tanker with the Gas Trailer , otherwise i want to detach the trailer from the truck.

Here is my code, i used the onTrailerAttach - Event:

addEventHandler("onTrailerAttach",getRootElement(),
function(truck)		
	local truckid = getElementModel(truck)
	local trailerid = getElementModel(source)
 
	--outputChatBox("ERGEBNIS: "..tostring(trailerid))
 
	if(truckid==515) then
		if(trailerid==450) then
			outputChatBox("Gute Fahrt")
		else
			outputChatBox("Deine Kupplung ist nicht fuer diesen Anhaenger ausgelegt - "..tostring(trailerid))
			detachTrailerFromVehicle(truck,source)
		end
	end
      end
)

This Code make this bug: The trailer detach from the truck, but reattach it immediatly. Please help how to avoid this bug!

greets

Link to comment

You detach the trailer when being in one place so it will reattach. I've had the problem with detachTrailerFromVehicle couple of days ago and couldn't do anything about it.

It also seems to reattach trailer for remote players when using detachTrailerFromVehicle while driving truck with attached trailer.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...