[Request] [Help] [Idea] Standalone Whitelist/Allowed Zones For Vehicle Spawns

I’ve been searching for days with no luck to find something like what I’m looking for. So I figured I’d put in the idea and perhaps someone with more lua knowledge than myself can look into creating it.

• Purpose: Script that allows spawning of vehicles only in certain zones. Vehicles can drive anywhere like they normally can. This is simply for spawning of vehicles.

• Reason: Garage systems all limit people into using just those garage systems. Also they are all esx/qbcore.

  • This would be so that standalone servers could have something like whitelisted areas for spawning vehicles too. Without all the other stuff. Such as yes garages or parking lots perhaps but any defined area really even a main spawn on their server or whatever they want. Of course this is to prevent people from being jank and spawning them in the middle of the road or whatever you know like they can normally on standalone servers.

• Potential issue?

  • Could we code it to where it knows the difference between if someone is spawning a vehicle versus if someone happened to just steal one/get into one or be seated-teleported into one.

• Features

Ideas?

I personally don’t have the time to create such a script, but you can use the entityCreated or entityCreating events to get their position and just delete them when it’s not inside a whitelisted area. Server events - Cfx.re Docs

This sounds like a good potential opportunity for routing buckets.

Now there are a few potential ways I could see you going about doing this:

  1. Use routing bucket security to disable ALL entities from all players (meaning players can’t spawn traffic, (e.g. peds), their own cars from menus, NOTHIN’
    1a. This would mean that you’ll need to spawn cars SERVER SIDED. There may be a way to spawn traffic on a per player basis, but for the most part, spawning (AND DELETING - including deleting blown up cars) would have to be managed by the server itself. Architecturally I could see this being more secure than having client scripts, but the overhead of processing would be on the server (meaning more threads run on hte server itself rather than the client).

  2. Option 2 ALSO uses routing buckets, but it toggles it off and on for a player based on parameters (which could include permissions), and can set the routing bucket security flag on the fly if:
    a. Player isn’t in the specified whitelist zone
    b. Player isn’t a non-admin

Challenge with 2:
The challenge is that I don’t know if setting routing bucket security settings on the fly requires a client restart, but it’s worth a shot.

Not sure if this could work, but if anyone has better ideas, I’m all game…

P.S. Resource on Routing buckets: