getSharedObject no longer exist

hello i have some scripts in my server thats spaming this someone can help me ?

i assume you updated your esx version to versio 1.9+ in which they deleted the esx.getSharedObject event. You basically have 2 options:
Go back to esx version <=1.8.5 or
Set this in every resource that throws this error:

fxmanifest.lua add:

shared_script ‘@es_extended/imports.lua’

In every script where you initialise ESX:
There will probably something like

ESX = nil
TriggerEvent(‘esx:getSharedObject’, function(obj) ESX = obj end)

Delete it and replace with:

ESX = exports[“es_extended”]:getSharedObject()

edit: Sorry that was my bad. If you use the shared script in fxmanifest.lua you don’t need to initialize esx in your resource as it happens automatically through the import. However you still can accomplish the same without touching the fxmanifest.lua and just use the

ESX = exports[“es_extended”]:getSharedObject()

3 Likes

Hi,

Incase you have multiple scripts using this and dont want to rewrite it all you can try this as “temporary bypass” since i dont know how long this will be supported.

In your es_extended folder go into client\common.lua and add the following code at the end of it

AddEventHandler("esx:getSharedObject", function(cb)
  cb(ESX)
end)

Do the same for server\common.lua. This should fix all the errors since the old esx calls are still compatible with the newest version.
But you should still look into updating the scripts to the newest ESX since i dont know how long this works.

Reference: GitHub - yiruzu/esx-getSharedObject-fix: This repository contains a fix for the old esx:getSharedObject event for the new ESX Legacy versions.

This will be supported for literally ever, its base functionality of FiveM. CFX would have to decide to break the entire game system for this type of callback functionality to no longer work.

its still doing the same

still the same

You will always receive those prints unless you remove the code that is generating that print.


You need to find those instances in your framework files, the ones that post that print, and then replace those handlers with the code above.

1 Like

It would now be: ESX = exports[‘es_extended’]:getSharedObject()