Merge pull request #1528 from esx-framework/get-shared-object

feat(es_extended/shared/main): restore backwards compat
This commit is contained in:
Arctos2win
2024-12-06 23:33:31 +01:00
committed by GitHub
+6 -3
View File
@@ -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 !)