Skip to content

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

Merged
Kenshiin13 merged 5 commits into
esx-framework:devfrom
Kenshiin13:spawn-vehicle
Dec 14, 2024
Merged

feat(es_extended): add promise support for vehicle spawn functions#1539
Kenshiin13 merged 5 commits into
esx-framework:devfrom
Kenshiin13:spawn-vehicle

Conversation

@Kenshiin13

Copy link
Copy Markdown
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.

Comment thread [core]/es_extended/server/modules/onesync.lua
@Kenshiin13 Kenshiin13 merged commit 30a850b into esx-framework:dev Dec 14, 2024
@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