How to save the position of a trailer
#1

Hi to all,
my friend and I are scripting a trucking server, but now we have a trouble: we want create a buyable trailers, but how we can save the position of trailer every time that stop? Thanks to all help us.
Reply
#2

if you mean:
"How can we save the position of a vehicles trailer every time the truck stops"

In my experience, syncing of trailers is very messy, I found one solution was to script in an auto re-connect function that is activated when the player sounds the horn.

if the horn is sounded
1) get the position and angle of the truck
2) get the position and angle of the trailer
3) if the trailer is within, say 6m of the truck, and the angles are similar
4) re-attach the trailer
5) after the trailer is re-connected you should be able to save the position

If you are going to base an entire gamemode on the use of trucks, I suggest you invest a lot of time in overcoming syncing issues. Good luck.
Reply
#3

And if instead use the horn, we use the "IsPlayerInVehicle" fuction and the "OnPlayerExitVehicle" fuction for get the trailer position?

However, thanks for help.
Reply
#4

You can try that, the only problem is that when a trailer disconnects from the truck that it is attached to, because a trailer has no driver, it will not be synced for every player.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)