Solve general getsharedobject problem

Hello,

I am using 1.10.1 esx and I have the problem with some scripts.
Is there a general solution for this? Do I have to do this every time, for every script that has the error?

Can someone help me with the script?

Cardealer2:

Client-Main:

ESX = nil

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

Citizen.Wait(10000)

ESX.TriggerServerCallback('nb_vehicleshop2:getCategories', function (categories)
	Categories = categories
end)

ESX.TriggerServerCallback('nb_vehicleshop2:getVehicles', function (vehicles)
	Vehicles = vehicles
end)

if Config.EnablePlayerManagement then
	if ESX.PlayerData.job.name == Config.job then
		Config.Zones.ShopEntering.Type = 1

		if ESX.PlayerData.job.grade_name == 'boss' then
			Config.Zones.BossActions.Type = 1
		end

	else
		Config.Zones.ShopEntering.Type = -1
		Config.Zones.BossActions.Type  = -1
	end
end

end)

Server-Main

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

TriggerEvent(‘esx_phone:registerNumber’, Config.job, _U(‘dealer_customers’), false, false)
TriggerEvent(‘esx_society:registerSociety’, Config.job, _U(‘car_dealer’), ‘society_cardealer’, ‘society_cardealer’, ‘society_cardealer’, {type = ‘private’})

Citizen.CreateThread(function()
local char = Config.PlateLetters
char = char + Config.PlateNumbers
if Config.PlateUseSpace then char = char + 1 end

if char > 8 then
	print(('nb_vehicleshop2: ^1WARNING^7 plate character count reached, %s/8 characters.'):format(char))
end

end)

Thanks a lot

Greetings @R3al_Nam3_H1dd3n,

1.10.1 esx is ESX Legacy since 1.9 the esx:getSharedObject is no longer used over the trigger now it must be implemented over the export. Here once the official docs to it: esx:getSharedObject Deprecation | ESX Documentation

I hope this helps you. If it is ESX 1.1 the problem will be somewhere else.

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