[SOLVED] Vehicle Deletes When Another Spawns Issue

I am having this really odd issue, and I can’t seem to figure out what is going on. I am trying to spawn players in a certain arrangement with vehicles. The server is sending a trigger to all clients to spawn and tp themselves into their car. This works perfectly. Now, my issue is that cars get deleted when the next one is spawned.

Player 1 gets their spawn fine. Player 2 has a slight delay (ping, hardware, etc) and spawns their car, but when Player 2’s car is spawned, it removes Player 1’s car. They are not spawning near each other, so I don’t think its a collision with the spawning.

If anyone has any idea what is going on, I’d realllly love to fix this.

I was having the same issues as you describe. And once i added this line after spawning the vehicles.

 --NEEDED TO allow for multiple trucks to spawn....
    SetEntityAsNoLongerNeeded(TOWMISSION.towtruck[NetworkPlayerIdToInt()])

When I used this command I stop having the issues.

Hope this helps.

1 Like

Really? That’s such an odd fix.

Are you able to set them back as mission entities afterward so they don’t despawn?

I am using this code in a tow truck mission, that is part of up coming fs_freeroam. I am not seeing the tow trucks despawn. I just know with out that line the next time someone tries to start the mission it will take the tow truck from the last player, if I don’t have that line.

I just tried it out. It works. Thank you so much! I’ve been driving myself crazy with this. Haha

Cool I am glad it worked. Happy playing. :slight_smile:

1 Like

I’m having this problem too but I must I say I’m turning in circles.

I created a spawn/delete vehicle location.
The createdVehicle function returns an entity which I store in a client local variable.

local activeVehicle = CreateVehicle(…)
When I delete it using DeleteVehicle(activeVehicle)

The vehicle spawned the same way by an other player is also deleted…

Any enlightment on this is welcomed :wink:

I must add that If I use SetEntityAsNoLongerNeeded(activeVehicle) after spawn

using DeleteVehicle() does not work…

Are you setting the vehicle as a mission entity right before deleting it?

Hi @Briglair No vehcile is not set as a mission entity

@Rudz Set as a missions entity right before deleting it for it to work

@Briglair OK I’ll try this ASAP (tomorrow). Thanks for your help

That was it THX @Briglair !

1 Like

Where you Delete that line ?

Where can i find that line ?