Hey everyone, I am new to FiveM. Been doing some research on how to get some cars to spawn at certain places in the map server-side, for example so that players could go to a drift map and just pick out a car they want without something like a vMenu. From reading the forums, it seems like the cars are made client-side and when players disconnect, spawned cars disappear. I just wanted to make sure what I have in mind is doable and I don’t shoot myself in the foot by doing a lot of work and then finding out it wasn’t possible to begin with. Here’s what I have in mind right now:
- Spawning the cars, when the first player connects to the server
Client-side: When a player connects check to see if the player is alone, if so send a message to the server to “SpawnVehicles” (Because we want only 1 of each car, that are supposed to be “server-side”)
Server-side: Then the server will have stored coordinates of vehicles and send a message back to the client to create mission entity vehicles at designated spots
What would be a good place to perform this operation?
-
Do a respawn of the car at the designated space, after a player has exited the car, after X amount of time
-
Do a respawn of the car after it is destroyed
How could I check when the car is destroyed? I tried a game event called: “CEventNetworkVehicleUndrivable” , with no success. Does it get called when only a player is sitting in the car? Also what parameters does it have? Is this Client-Side?
Also is there a limit on how many vehicles I can spawn?
If anyone could pitch in if this would be possible for me to make, that would be awesome!