Cars despawn when player gets far

Well, I just updated my server to the latest artifact and a strange bug appeared. Many players report that their vehicles despawn when they get away from them. That itself ain’t bad cause I understand that improves performance. The problem is that they despawn

  1. even if the player stays close
    2)almost instantly, so the bug practically renders teleporters useless.

Anyone has any idea on how to increase the time it takes to despawn or remove the feature completely. Also, I should mention that along with the artifact I updated my vMenu so that may be the issue.

Thanks in Advance

2 Likes

If no player is nearby, an entity gets deleted - this has always been the case except for a number of builds at some point where client-spawned script entities would be persistent, but that led to lots of issues where abuse scripts or badly-written spawn scripts would lead to persistent client crashes.

If you want a vehicle to remain persistent, spawn it on the server. A flag on the server to make a client-spawned vehicle persistent may be offered in the future, too.

2 Likes

I tried to spawn them on the server-side but It didn’t work

3 Likes

I have the same problem here, I am using version 2949 latest, how do I do what you say on the server side?

1 Like

The native responsible for creating vehicles is now available on server side.

CreateVehicle
1 Like

I tested it and they still despawn

1 Like

I noticed on latest artifact with onesync infinity if a vehicle is spawned on the client it will persist even if the player gets out the the vehicle’s scope and nobody is around, but if the player leaves the server it will despawn. Is this intended behaviour?

2 Likes

I keep disappearing …

4 Likes

how do you use onesync?
+set onesync on
onesync_enabled true
onesync legacy

how do you use it?

6 Likes

set onesync on

1 Like

I now switch to onesync legacy, and for now it works as long as I don’t disconnect from the server.

And if I am next to a car and the person disconnects, I cannot get in the car, it is bugged.

1 Like

I use the code below for spawning vehicles and they despawn never.
Even if the player leaves the server, the vehicle don’t despawn.
I think that there is no more than this possible when it comes to despawning vehicles.

example.lua (client)

local vehicle = CreateVehicle(model, coords.x, coords.y, coords.z + 1.0, heading, true, false)

SetVehicleNeedsToBeHotwired(vehicle, false)
SetVehicleHasBeenOwnedByPlayer(vehicle, true)
SetEntityAsMissionEntity(vehicle, true, true)
SetVehicleIsStolen(vehicle, false)
SetVehicleIsWanted(vehicle, false)
SetVehRadioStation(vehicle, 'OFF')

server.cfg

set onesync_distanceCullVehicles true
set onesync_forceMigration true
1 Like

this doesn’t work

1 Like

You have also rewrite your .lua files?

2 Likes

How do you use onesync? I am now using in server.cfg

onesync_enabled true

But I have also tried + set onesync on in run_server.bat properties

I have also tried onesync legacy in server.cfg (With this they last a little longer)

But I think it’s a onesync problem, because mumble-voip also works badly for me, the voices mix when you get closer or further away. Everything’s wrong since I used the latest version of Artefactos 2949

3 Likes

Anything on this? I have been experiencing this issue too lately. Running 2949 onesync on with onesync_population false

1 Like

the vehicle does not come out using your code, would you have a better example to share? because I have everything well set but the vehicle does not spawn

2 Likes

Bro, did you adapt to variables of this code for the used by your script?

In my Script (vrp_garages) the variable which contain the car info to spawn is nveh, so where has vehicle i needed to put nveh instead of vehicle

SetVehicleIsStolen(nveh,false)
				SetVehicleNeedsToBeHotwired(nveh,false)
				SetVehicleOnGroundProperly(nveh)
				SetVehicleNumberPlateText(nveh,vRP.getRegistrationNumber())
				SetEntityAsMissionEntity(nveh,true,true)
				SetVehRadioStation(nveh,"OFF")
				SetVehicleHasBeenOwnedByPlayer(nveh, true) --SUGGESTION BY TIGODEV (FORUM)
				SetVehicleIsWanted(nveh, false) --SUGGESTION BY TIGODEV (FORUM)

There is mine

1 Like

What version artefacts?

Lucious which artifact version you are using? I’m still having issues with despawning cars.

1 Like