Posts: 728
Threads: 109
Joined: May 2015
Reputation:
0
any ideas on how to automatically re-attach the trailer to a vehicle after it de-attached?
Posts: 1,076
Threads: 70
Joined: Jul 2016
Reputation:
0
Create an integer variable for each vehicle (in this case an array) - let's called it trailerId, and set it to the trailer's ID (vehicle id because trailers are vehicles) whenever someone attaches a trailer to their vehicles, then to INVALID_VEHICLE_ID when they detach it.
Create a reoccurring timer, that loops through vehicles and checks if their trailerId equals INVALID_VEHICLE_ID, if not, attach the trailer with that id if it's not attached already.
Posts: 728
Threads: 109
Joined: May 2015
Reputation:
0
wouldnt a reoccurring timer that checks trough all vehicles of all players cause some lag?
should i just create a timer that only checks the vehicle to whom you can attach a trailer?would that be more optimized?