Skip to content

fix(es_extended/client/modules/events.lua): Fix VehicleProperties Not…#1664

Merged
Kenshiin13 merged 1 commit into
esx-framework:devfrom
Meyndflay:VehicleProperties
Jul 6, 2025
Merged

fix(es_extended/client/modules/events.lua): Fix VehicleProperties Not…#1664
Kenshiin13 merged 1 commit into
esx-framework:devfrom
Meyndflay:VehicleProperties

Conversation

@Meyndflay

@Meyndflay Meyndflay commented Jul 6, 2025

Copy link
Copy Markdown

… Updating Properly

Description

This PR fixes "VehicleProperties" not applying due to entity not existing yet.


Motivation

Certain cars that I have tried to spawn sometimes failed to apply their respective vehicle data. The common trend I noticed was this occurred on custom vehicles. While the entities are created on the server and on the server side, they have their network Ids, it seems this wasn't always the case for the client, and since it may take time for certain custom cars to spawn on the client, NetToVeh() will fail and cause the rest of the code to not run, hence not applying VehicleProperties.


Implementation Details

The previous code was already calling NetToVeh() before the while not NetworkDoesEntityExistWithNetworkId(netId) do line code. This causes models that take long to stream/spawn such as custom cars to run NetToVeh() while not yet existing and will return a message in F8 console saying "No object by ID exists" or something similar.

This simple fix will ensure the entity exists first before calling NetToVeh.


Usage Example


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.

@github-project-automation github-project-automation Bot moved this to 🆕 To be Discussed in ESX Roadmap Jul 6, 2025
@Kenshiin13 Kenshiin13 changed the base branch from main to dev July 6, 2025 13:49

@Kenshiin13 Kenshiin13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@github-project-automation github-project-automation Bot moved this from 🆕 To be Discussed to Ready for Next Update in ESX Roadmap Jul 6, 2025
@Kenshiin13 Kenshiin13 merged commit 277630b into esx-framework:dev Jul 6, 2025
2 checks passed
@Meyndflay Meyndflay deleted the VehicleProperties branch July 7, 2025 13:35
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.

3 participants