can i set chance for item to 0.1%?
Now i think about it you can’t. But if you change the server sided code a bit it will work
local _source = source
local randomAmount = math.random(1, 1000)
local xPlayer = ESX.GetPlayerFromId(_source)
for i = 1, #Config['rewards'] do
local randomAmount = randomAmount - Config['rewards'][i]['chance'] * 10
if randomAmount < 1 then
if xPlayer then
if xPlayer.canCarryItem(Config['rewards'][i]['item'], Config['rewards'][i]['amount']) then
xPlayer.addInventoryItem(Config['rewards'][i]['item'], Config['rewards'][i]['amount'])
randomAmount = 1000
break
else
xPlayer.showNotification(Config['translation'][Config.Language]['cant_carry'])
end
end
end
end
The lines that i changed are
local randomAmount = math.random(1, 1000) – went from 100 to 1000
local randomAmount = randomAmount - Config[‘rewards’][i][‘chance’] * 10 – added the * 10
if randomAmount < 1 then – removed the ‘=’ so the value has to be less than 1 and not equal or less than 1
randomAmount = 1000 – ressets the value to 1000 if the trigger has been done by 2 players at the same time (almost impossible to happen)
Item(‘metaldetector’, function(data, slot)
TriggerEvent(‘prospecting:check’)
end)
hmm, can i dm you somewhere? i cant make it work for more than 1 item
I cant share my discord sadly, so if you could send me a screenshot of you Config and of the server side code
i also send you a screenshot of my confic
I have added the ability to select between ox_inventory and menu_default/default inventory for ESX