Problème de communication avec ESX

Votre topic doit au minimum contenir les informations suivantes :

Bonjour, bonsoir

● Machine locale ● J’ai toutes les bases es esx ● Un script que je fais a un problème avec esx J’obtiens cette erreur,

Mon script est un job qui permet de réparer des clims et il plante au niveau du check de clim au premier spawn mais si je redémarre la ressource je n’ai pas d’erreur et tout fonctionne voici mon code client `ESX = nil local PlayerData = {} heist = false gived = false repair1 = false repair2 = false started = false key = 38 Citizen.CreateThread(function() while ESX == nil do TriggerEvent(‹ esx:getSharedObject ›, function(obj) ESX = obj end) Citizen.Wait(0) end end) RegisterNetEvent(‹ esx:playerLoaded ›) AddEventHandler(‹ esx:playerLoaded ›, function(xPlayer) ESX.GetPlayerData() PlayerData = xPlayer while xPlayer ~= nil or data_job ~= nil or job_name ~= nil do local data_job = ESX.PlayerData.job local job_name = ESX.PlayerData.job.name Citizen.Wait(50) end started = true end) local blips = { {title=« Réparations de clim », colour=5, id=402, x = 888.48, y = -958.12, z = 44.18}; {title=« Réparations de clim », colour=5, id=402, x = 437.6, y = -993.77, z = 43.69}

	}

function Draw3DText(x, y, z, scl_factor, text) local onScreen, _x, _y = World3dToScreen2d(x, y, z) local p = GetGameplayCamCoords() local distance = GetDistanceBetweenCoords(p.x, p.y, p.z, x, y, z, 1) local scale = (1 / distance) * 2 local fov = (1 / GetGameplayCamFov()) * 100 local scale = scale * fov * scl_factor if onScreen then SetTextScale(0.0, scale) SetTextFont(0) SetTextProportional(1) SetTextColour(255, 255, 255, 255) SetTextDropshadow(0, 0, 0, 0, 255) SetTextEdge(2, 0, 0, 0, 150) SetTextDropShadow() SetTextOutline() SetTextEntry(« STRING ») SetTextCentre(1) AddTextComponentString(text) DrawText(_x, _y) end end

Citizen.CreateThread(function() while not started do Citizen.Wait(5) end while true do Citizen.Wait(0) local data_job = ESX.PlayerData.job local job_name = ESX.PlayerData.job.name if data_job ~= nil and job_name == ‹ frigo › then job = true for _, info in pairs(blips) do info.blip = AddBlipForCoord(info.x, info.y, info.z) SetBlipSprite(info.blip, info.id) SetBlipDisplay(info.blip, 4) SetBlipScale(info.blip, 0.9) SetBlipColour(info.blip, info.colour) SetBlipAsShortRange(info.blip, true) BeginTextCommandSetBlipName(« STRING ») AddTextComponentString(info.title) EndTextCommandSetBlipName(info.blip) end

	elseif data_job ~= nil and not job_name == 'frigo' then
		job = false
	end
	if(GetDistanceBetweenCoords(888.48, -958.12, 44.18, GetEntityCoords(PlayerPedId()),false)) < 15.0 and not repair1 and job then -- Spot clim #1
		Draw3DText(888.48, -958.12, 44.18, 1.5, "Appuyez sur ~o~E~o~ pour réparer !")
		if(GetDistanceBetweenCoords(888.48, -958.12, 44.18, GetEntityCoords(PlayerPedId()),false)) < 1.0 then -- Spot clim #1
			
			if IsControlPressed(0, key)  then
				local pid = PlayerPedId()
				RequestAnimDict("mini")
				RequestAnimDict("[email protected]")
				while (not HasAnimDictLoaded("[email protected]")) do Citizen.Wait(0) end
				TaskPlayAnim(pid,"[email protected]","fixing_a_player",1.0,-1.0, 20000, 0, 1, false, false, false)
				Citizen.Wait(14000)
				TriggerServerEvent("frigo:pay")
				ESX.ShowNotification("Vous avez reçu 550 € pour votre travail", true, true, 20)
				repair1 = true
				if not job then 
					SetPlayerWantedLevel(PlayerId(), 3, false)
				end
			end
		end
	elseif (GetDistanceBetweenCoords(437.6, -993.77,43.69, GetEntityCoords(PlayerPedId()),false)) < 15.0 and not repair2 and job  then --
		Draw3DText(437.6, -993.77, 43.69, 1.5, "Appuyez sur ~o~E~o~ pour réparer !")
		if (GetDistanceBetweenCoords(437.6, -993.77,43.69, GetEntityCoords(PlayerPedId()),false)) < 1.0 then
			if IsControlPressed(0, key) then
				local pid = PlayerPedId()
				RequestAnimDict("mini")
				RequestAnimDict("[email protected]")
				while (not HasAnimDictLoaded("[email protected]")) do Citizen.Wait(0) end
				TaskPlayAnim(pid,"[email protected]","fixing_a_player",1.0,-1.0, 20000, 0, 1, false, false, false)
				Citizen.Wait(14000)
				TriggerServerEvent("frigo:pay")
				ESX.ShowNotification("Vous avez reçu 550 € pour votre travail", true, true, 20)
				repair2 = true
				heist = true
				if not job then 
					SetPlayerWantedLevel(PlayerId(), 3, false)
					heist = false
				end
			end
		end
	elseif (GetDistanceBetweenCoords(452.15, -973.54,30.69, GetEntityCoords(PlayerPedId()),false)) < 5.0 then --
		Draw3DText(452.15, -973.54, 30.69, 1.5, "Appuyez sur ~o~E~o~ pour voler la carte de la banque")
		if (GetDistanceBetweenCoords(452.15, -973.54,30.69, GetEntityCoords(PlayerPedId()),false)) < 1.0 then
			if IsControlPressed(0, key) and not gived then
				local pid = PlayerPedId()
				RequestAnimDict("mini")
				RequestAnimDict("[email protected]")
				while (not HasAnimDictLoaded("[email protected]")) do Citizen.Wait(0) end
				TaskPlayAnim(pid,"[email protected]","fixing_a_player",1.0,-1.0, 5000, 0, 1, false, false, false)
				if job and heist then
					Citizen.Wait(5000)
					TriggerServerEvent("frigo:give",Config.Item)
					gived = true
				end
				if not job then
					SetPlayerWantedLevel(PlayerId(), 3, false)
					Citizen.Wait(5000)
					TriggerServerEvent("frigo:give",Config.Item)
					gived = true
					heist = true
				end
			end
		end
		
		
		
	end
end

end) Citizen.CreateThread(function() while true do if repair1 then Citizen.Wait(900000) repair1 = false end if repair2 then Citizen.Wait(900000) repair2 = false end Citizen.Wait(0) end end)

et mon script serveur ESX = nil

Citizen.CreateThread(function() while ESX == nil do TriggerEvent(‹ esx:getSharedObject ›, function(obj) ESX = obj end) Citizen.Wait(0) end end) RegisterServerEvent(‹ frigo:give ›) AddEventHandler(‹ frigo:give ›, function(item) print(« Item recup : OK ») local _source = source local xPlayer = ESX.GetPlayerFromId(_source) xPlayer.addInventoryItem(item, 1) end)

RegisterServerEvent(‹ frigo:pay ›) AddEventHandler(‹ frigo:pay ›, function()

local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
xPlayer.addMoney(550)
print("Paiement : 550")

end)`

Cela fait 3 jours que je suis dessus et je n’ai pas trouve d’aide en ligne mais seulement le while xPlayer ~= nil or data_job ~= nil or job_name ~= nil do local data_job = ESX.PlayerData.job local job_name = ESX.PlayerData.job.name Citizen.Wait(50) end

Salut.

J’aimerais t’aider mais le post est comment dire illisible Tu peux lui re faire une beauté et je t’aiderais avec plaisir

Cordialement