From 2d8895b8d776c13c2ae8b694a9b65381aab7a525 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Thu, 29 Sep 2022 11:08:44 -0500 Subject: [PATCH] Don't delay resource start/ready signals --- scripts/client/event.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/scripts/client/event.js b/scripts/client/event.js index c96197af..983cf904 100644 --- a/scripts/client/event.js +++ b/scripts/client/event.js @@ -63,13 +63,10 @@ function onResourceStart(event, resource) { addEventHandler("OnPedExitedSphereEx", onPedExitedSphere); } - garbageCollectorInterval = setInterval(collectAllGarbage, 1000 * 60); - localPlayerMoneyInterval = setInterval(updateLocalPlayerMoney, 1000 * 5); - if (resource == thisResource) { - setTimeout(function () { - sendResourceStartedSignalToServer(); - }, 500); + garbageCollectorInterval = setInterval(collectAllGarbage, 1000 * 60); + localPlayerMoneyInterval = setInterval(updateLocalPlayerMoney, 1000 * 5); + sendResourceStartedSignalToServer(); } } @@ -84,11 +81,10 @@ function onResourceStop(event, resource) { // =========================================================================== function onResourceReady(event, resource) { - loadLocaleConfig(); - - setTimeout(function () { + if (resource == thisResource) { + loadLocaleConfig(); sendResourceReadySignalToServer(); - }, 500); + } } // ===========================================================================