diff --git a/[core]/es_extended/shared/main.lua b/[core]/es_extended/shared/main.lua index 0e78f0cb7..00f775b46 100644 --- a/[core]/es_extended/shared/main.lua +++ b/[core]/es_extended/shared/main.lua @@ -4,9 +4,12 @@ exports("getSharedObject", function() return ESX end) -AddEventHandler("esx:getSharedObject", function() - local Invoke = GetInvokingResource() - error(("Resource ^5%s^1 Used the ^5getSharedObject^1 Event, this event ^1no longer exists!^1 Visit https://documentation.esx-framework.org/tutorials/tutorials-esx/sharedevent for how to fix!"):format(Invoke)) +AddEventHandler("esx:getSharedObject", function(cb) + if ESX.IsFunctionReference(cb) then + cb(ESX) + end + local invokingResource = GetInvokingResource() + print(("^3[WARNING]^0 Resource ^5%s^0 used the ^5getSharedObject^0 event. This is not the recommended way to import ESX. Visit https://documentation.esx-framework.org/tutorials/tutorials-esx/sharedevent to find out why."):format(invokingResource)) end) -- backwards compatibility (DO NOT TOUCH !)