I am new to lua so sorry if my code may look bad, I have been trying to randomize the x, y, z values in a table without a success. How could I do so?
Here is an error I get:
Error loading script jobs/poolworker.lua in resource esx_jobs: @esx_jobs/jobs/poolworker.lua:156: attempt to index a nil value (global 'Delivery')
Here is my current script:
Config.Jobs.slaughterer = {
Delivery = {
Pos = {x,y,z},
Color = {r = 50, g = 200, b = 50},
Size = {x = 5.0, y = 5.0, z = 3.0},
Marker = 1,
Blip = true,
Name = _U('delivery_point'),
Type = 'delivery',
Spawner = 1,
Item = {
{
name = _U('delivery'),
time = 0.5,
remove = 1,
max = 100, -- if not present, probably an error at itemQtty >= item.max in esx_jobs_sv.lua
price = 13,
requires = 'bottle',
requires_name = _U('chl_bottle'),
drop = 100
}
},
Hint = _U('p_deliver_button')
}
}
}
test = {x = 162.329666, y = -194.452744, z = 54.217529}
if delivery == 1 then
table.insert(Delivery[1]["Pos"], test)
elseif delivery == 2 then
table.insert(Delivery[1]["Pos"], test)
end ```
[1]: https://i.stack.imgur.com/ZIXhJ.png
Thank you, whoever is going to help me.