From 75799c88c74bee043119d6e45a2c93f9c6b4742c Mon Sep 17 00:00:00 2001 From: Arctos2win <116841243+Arctos2win@users.noreply.github.com> Date: Mon, 2 Oct 2023 20:52:42 +0200 Subject: [PATCH] Update functions.lua --- [core]/es_extended/client/functions.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/[core]/es_extended/client/functions.lua b/[core]/es_extended/client/functions.lua index d8c20a17..b7f6ffdf 100644 --- a/[core]/es_extended/client/functions.lua +++ b/[core]/es_extended/client/functions.lua @@ -359,6 +359,12 @@ function ESX.Game.SpawnVehicle(vehicleModel, coords, heading, cb, networked) if not vector or not playerCoords then return end + + local dist = #(playerCoords - vector) + if dist > 424 then -- Onesync infinity Range (https://docs.fivem.net/docs/scripting-reference/onesync/) + local executingResource = GetInvokingResource() or "Unknown" + return print(("[^1ERROR^7] Resource ^5%s^7 Tried to spawn vehicle on the client but the position is too far away (Out of onesync range)."):format(executingResource)) + end CreateThread(function() ESX.Streaming.RequestModel(model)