-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Issue: The progress bar was not syncing with actual game events. It appeared to increment artificially rather than reflecting FiveM’s loadProgress updates.
Cause: The React component was only using a setTimeout loop to increase progress, so it wasn’t tied to FiveM’s event system.
Fix: Added a listener for the loadProgress event:
useEffect(() => {
const handleMessage = (event) => {
if (event.data.eventName === "loadProgress") {
setProgress(event.data.loadFraction * 100);
}
};
window.addEventListener("message", handleMessage);
return () => window.removeEventListener("message", handleMessage);
}, []);
Result: The progress bar now syncs correctly with game loading event in real time.
Metadata
Metadata
Assignees
Labels
No labels