Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] - es_extended - Better handling of getting entity type #1308

Closed
mikigoalie opened this issue Feb 5, 2024 · 6 comments
Closed
Assignees
Labels
enhancement New feature or request

Comments

@mikigoalie
Copy link

There is small overseen issue with getvehicletype RPC

local xPlayer = ESX.OneSync.GetClosestPlayer(coords, 300)

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.

@mikigoalie mikigoalie added the enhancement New feature or request label Feb 5, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in ESX Roadmap Feb 5, 2024
@Mycroft-Studios
Copy link
Member

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.

@mikigoalie
Copy link
Author

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

@Mycroft-Studios
Copy link
Member

what is your usecase for spawning vehicles outside of onesync range anyway?

@mikigoalie
Copy link
Author

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

@Mycroft-Studios
Copy link
Member

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.
:)

@Gellipapa
Copy link
Contributor

@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.

@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in ESX Roadmap Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

No branches or pull requests

4 participants