Hello anyone hv an idea to put function “check item” in this loop?
i mean check item if yes can cutting wood if not just show error “No Hatchet”
Citizen.CreateThread(function()
while true do
local sleep = 1000
local playerPed = PlayerPedId()
local playerCoords = GetEntityCoords(playerPed)
for i = 1, #closestWood do
local x = GetClosestObjectOfType(playerCoords, 2.0, GetHashKey(closestWood[i]), false, false, false)
local entity = nil
if DoesEntityExist(x) then
entity = x
Wood = GetEntityCoords(entity)
sleep = 5
DrawText3D(Wood.x, Wood.y, Wood.z + 1.5, 'Press [~g~E~s~] to harvest the ~b~wood~s~')
if IsControlJustReleased(0, 38) then
if not cachedWood[entity] then
OpenWood(entity)
else
ESX.ShowNotification('~r~This wood has already been cut.~s~')
end
end
break
else
sleep = 1000
end
end
Citizen.Wait(sleep)
end
end)
Thank you for any help in advance