[MRP] ProAiron Posted September 2, 2009 Share Posted September 2, 2009 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
Gamesnert Posted September 2, 2009 Share Posted September 2, 2009 Instead of this detachTrailerFromVehicle(truck,source) do this cancelEvent() Does that solve the issue? Link to comment
[MRP] ProAiron Posted September 2, 2009 Author Share Posted September 2, 2009 No, it dont solve the issue - it doesnt happen anything ^^ Link to comment
50p Posted September 2, 2009 Share Posted September 2, 2009 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now