mkafrin/PolyZone

(Not an Issue) No Vehicles Spawning In Zone

ItsNapp opened this issue · 1 comments

Is there a way I can make it so No Vehicles are able to spawn in a specific zone that I set?

@NappTheDev Hmm, this is a tough one due to current limitations running PolyZone server-side. There is the entityCreating event on the server (docs here https://docs.fivem.net/docs/scripting-reference/events/server-events) that can be cancelled to instantly delete the entity. Testing whether the entity is a vehicle and is in a zone, and if so cancelling the event would work, but PolyZone isn't officially supported server-side as of now. You could try using it for this and see if you run into any errors, but it's not officially supported.

A possible client-side solution would be to use GetGamePool (https://docs.fivem.net/natives/?_0x2B9D4F50) to iterate over all CVehicle and if any are in the zone, call DeleteEntity on them. But that'd be pretty expensive and prone to issues like flickering.

Not sure if there's a great solution for this unless the first one works without any issues popping up.