fix(es_extended/client/modules/events.lua): Fix VehicleProperties Not…#1664
Merged
Conversation
… Updating Properly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… 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 applyingVehicleProperties.Implementation Details
The previous code was already calling
NetToVeh()before thewhile not NetworkDoesEntityExistWithNetworkId(netId) doline code. This causes models that take long to stream/spawn such as custom cars to runNetToVeh()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