guy293
27
I see couple of fixes for your code.
Why not having all the functions in one file and have client.lua & server.lua? It’s not a big script that needs separate files.
I like that you use ESX.IsPlayeraloaded() function instead of spamming it like everyone does.
I liked how you defined the function like this funcname = function(args)
Instead as just defining it.
And impement i18n localization system using ESX. Not everyone is French… At least release in English…
Beside that, Great release!
MMMmmmm isn’t this script a bad copy of esx_sit ?
You are not event checking the closest object after the button is pushed, very bad for performances.
compared to
The only thing you add is a percentage changing through time.
2 Likes
KeN1
30
A good fix would be that you dont see the dumpters. The “Press E” while in a vehicle. I have tried but I couldent fix it
Citizen.CreateThread(function()
Citizen.Wait(100)
while true do
local sleep = 1000
local playerPed = PlayerPedId()
local playerCoords = GetEntityCoords(playerPed)
for i = 1, #closestBin do
local x = GetClosestObjectOfType(playerCoords, 1.0, GetHashKey(closestBin[i]), false, false, false)
local entity = nil
if DoesEntityExist(x) then
sleep = 5
entity = x
bin = GetEntityCoords(entity)
drawText3D(bin.x, bin.y, bin.z + 1.5, 'Tryck [~g~E~s~] för att söka ~b~soptunnan~s~')
if IsControlJustReleased(0, 38) then
if not IsPedSittingInAnyVehicle(playerPed) then
if not cachedBins[entity] then
openBin(entity)
else
sendNotification('You already searched here!', 'error', 2000)
end
else
sendNotification('You can't do this in a vehicle!', 'error', 2000)
end
end
break
else
sleep = 1000
end
end
Citizen.Wait(sleep)
end
end)
ESX = nil
percent = false
searching = false
cachedBins = {}
bins = {
'prop_dumpster_01a',
'prop_dumpster_02a',
'prop_dumpster_02b'
}
Citizen.CreateThread(function()
while ESX == nil do
Citizen.Wait(5)
TriggerEvent("esx:getSharedObject", function(library)
ESX = library
end)
end
end)
Citizen.CreateThread(function()
local playerPed = PlayerPedId()
while true do
Citizen.Wait(0)
if not IsPedSittingInAnyVehicle(playerPed) then
if searching then
DisableControlAction(0, 73)
end
local playerCoords = GetEntityCoords(playerPed)
local bin, distance = ESX.Game.GetClosestObject(bins, playerCoords)
if distance ~= -1 and bin ~= -1 and distance <= 1.0 then
if percent then
binCoords = GetEntityCoords(bin)
drawText3D(binCoords.x, binCoords.y, binCoords.z + 1.5, TimeLeft .. '~g~%~s~')
else
drawText3D(binCoords.x, binCoords.y, binCoords.z + 1.5, 'Tryck [~g~E~s~] för att söka ~b~soptunnan~s~')
end
if IsControlJustReleased(0, 38) then
if not cachedBins[bin] then
openBin(bin)
else
sendNotification('Du har redan letat här!', 'error', 2000)
end
end
end
end
end
end)
Using ESX core functions alternative. I may have broken the countdown display tho. But easy to fix if broken. Actually at work so I can’t test it 
1 Like
Its not working with esx_garbage job
Drv1g
36
SCRIPT ERROR: @es_extended/server/classes/player.lua:323: attempt to index a nil value (local 'item')
> refe[0m (e[36m@es_extended/server/classes/player.lua
> handlere[0m (e[36m@esx_sopletare/server/main.lua
Any advices?
You haven’t changed the items in server.lua, you probably don’t have all the items in your database that i have.
Great job here is me but I would like to ask how can I change the other part to english where you press e on the keyboard or RB on the controller I can’t seem to find where to change that.
I found out where to change what it says in the code thanks for this nice script
Here is my second screenshot
I have a good idea is there away I could add money to this script so there could be a possibility that they could find money?
what hud for health/armour/food/water are you using?
even if it was a direct copy as long as the original author is given credit i dont think theres a issue unless the author says no to any re releases
What do I do if the bin never gives an item? please help someone!
Which version of es_extended are you using?