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

feat(es_extended): add promise support for vehicle spawn functions #1539

Merged
merged 5 commits into from
Dec 14, 2024

Conversation

Kenshiin13
Copy link
Contributor

Description

This PR enhances the ESX vehicle spawn functions to allow waiting for vehicle creation using promises, instead of requiring a callback function. Additionally, a resource leak in the ESX.Game.SpawnVehicle function has been addressed. The function now returns immediately when an invalid vehicle is requested instead of creating stale threads.

Example

local vehicle = ESX.Game.SpawnVehicle(model, coords, heading)
local vehNetId = ESX.OneSync.SpawnVehicle(model, coords, heading, vehProps)

PR Checklist

  • My commit messages and PR title follow the Conventional Commits standard.
  • My changes have been tested locally and function as expected.
  • My PR does not introduce any breaking changes.
  • I have provided a clear explanation of what my PR does, including the reasoning behind the changes and any relevant context.

@Kenshiin13 Kenshiin13 merged commit 30a850b into esx-framework:dev Dec 14, 2024
1 check passed
@Kenshiin13 Kenshiin13 deleted the spawn-vehicle branch December 14, 2024 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Ready for Next Update
Development

Successfully merging this pull request may close these issues.

2 participants