[HELP] Use the getSharedObject Event, this event no longer exists

How to resolve this problem please ?

1 Like

You should read the error message :cowboy_hat_face:

1 Like

Hey @CelineDumont89,

try to add the following line of code in to the fxmanifest.lua of your qs-smartphone resource.

shared_script '@es_extended/imports.lua'

Now all you have to do is read through the scripts and remove code like this:

ESX = nil

Citizen.CreateThread(function()
    while ESX == nil do
        TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
        Citizen.Wait(0)
    end
end)

or this:

ESX = nil

TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)

If you did the steps right, it should resolve the problem.

11 Likes

If you would do this, the script wont work right? what will trigger the getSharedObject?

1 Like

Hey @Knoz9,
the getSharedObject is EOL/Deprecated. It was replaced with an Export/Import method.

Export​

The Export can be simply used by doing:

ESX = exports["es_extended"]:getSharedObject()

Import​

The import can be used by simply adding this into the fxmanifest.lua:

shared_script '@es_extended/imports.lua'

More information about esx:getSahredObject Deprecation can you find here: esx:getSharedObject Deprecation | ESX Documentation

2 Likes

hi, ive got the same problem but i already did these steps on my whole server.
how can i fix it

Read the docs, thats why it tells you to. if you cannot understand “Remove these lines of code” and “add this line of code”, you should go learn basic programming and stop making a fivem server until u can.

3 Likes

just what I was looking for…

Excellent

1 Like

i did this but got this error with gks

2 Likes

Same…

1 Like

same still

you still have ESX = nil on top of the script, if the script is escrowed reach out to the creator

just a quick question this new export Code

ESX = exports["es_extended"]:getSharedObject()

“es_extended” . is the database name or a code i should keep it the same ?

Is the name of the resource where the export come from

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.