esx_core
esx_core copied to clipboard
[Feature Request] - es_extended - Better handling of getting entity type
There is small overseen issue with getvehicletype RPC https://github.com/esx-framework/esx_core/blob/7c59848a08a4bf6e17a36a4c44f20197aa698a79/%5Bcore%5D/es_extended/server/onesync.lua#L91
Currently, if there are no players near given coords, the function will fail without proper handling. I suggest to pass the rpc to any other random player or cache it until someone appears nearby.
Use case should be self explainatory, but: Creating a vehicle in onesync zone with no player will result in an error.
this is set to 300 to allow wiggle room. if the player is 423m out, and it gets called, they just have to walk for a second, and suddenly they out are out of oncesync range, which could result in much more issues. caching is also just not possible here.
I understand why it's locked within 300 units, but I still believe A.) We should handle this case to prevent errors (or passing events to invalid sources atleast) B.) We could still retrieve vehicle type from any other player that's not within the range.
If you consider second option to bring more issues ( i assume statebags would be the problem here and entity ownership ), then you may close this issue
what is your usecase for spawning vehicles outside of onesync range anyway?
what is your usecase for spawning vehicles outside of onesync range anyway?
Generally, in most cases it's fine if the source is within 400 units, but there was a case where I needed to create entity far from the entity, which was then tracked on the map etc. Very speecific, however I thought it'd be good idea to mention it as it's not really handled at all atm
what is your usecase for spawning vehicles outside of onesync range anyway?
Generally, in most cases it's fine if the source is within 400 units, but there was a case where I needed to create entity far from the entity, which was then tracked on the map etc. Very speecific, however I thought it'd be good idea to mention it as it's not really handled at all atm
For that, id recommend putting a blip where it would spawn, and then spawning the vehicle when the player gets close. :)
@mikigoalie Hi! As @Mycroft-Studios said you can do this, you manage the whole process server-side and update the coordinate from the server and send it back to the client.