DarkRP - Vehicles disappear once player (car dealer) disconnects

Hello, I own a DarkRP server where you can choose to be a car dealer. The car dealer has a list of cars in the F4 menu, he can buy these and sell them to the people that need them. Problem is, when the car dealer disconnects all of his cars of which he sold disappear.

Any ideas?

Because when a player leaves their entities gets deleted.

Thank you for the informative post. I was wondering how I could prevent that from happening.

Make a system where the car dealer can give ownership of the entity, thus making it not his ent

The car dealer can currently “sell” the vehicle, basically getting rid of his ownership. This allows other players to purchase the car like they would a door in DarkRP. The new owner can modify it as if it was his own ent, and it shows up as his when you approach the car. They still disappear on the original ent owners disconnect. Any other ideas?

If you haven’t done this already, try going into the fpp settings and uncheck the box that says “clean up players entities on disconnect” or something like that

Im not exactly sure where it would be located but look around

This would work, but it would end up causing more lag because of peoples props everywhere when they don’t need to be. What you could do is somehow make the car owned by the person who paid for it in FPP.

Right now I have the fpp setting to keep players entities on disconnect but it seems this applies strictly to props. Everything else still disappears.

Vehicles get removed here: https://github.com/FPtje/DarkRP/blob/master/gamemode/server/gamemode_functions.lua#L788

You could try and comment it out and see how it goes.

Alright, I made the changes and will be trying them soon. Thanks, I’ll get back to you guys on if it works or not.

[editline]23rd June 2013[/editline]

Alright, it seems to be working good. The cars stay after the player disconnects. However this could lead to a potential problem.

Cars are expensive to prevent joining and fucking everyone over by running them down. They’re also expensive to put a mild boundary on how many cars there should be. If people keep buying cars and disconnecting, eventually random cars on the street will be there with no owner and could fill up the server eventually. The fix you provided works well as a temp fix where I can look out for disconnected players cars, but is it possible to switch the ownership of the entity to another person as if they spawned it?

Bump!

I have been looking for a solution to this as well. Been stumped on it for a few days.
I am just looking for a way to transfer the ownership of the vehicle to another person. Perhaps we could do something with the F2 function in DarkRP.

Any help would be appreciated. Thanks!

www.darkrp.com -> forum
Hope that bo sees it :slight_smile: