Hey,
so battle of me and F tables continues.
I would like to be able to call a name of the table to which I’m gonna be close to. I can’t quite figure out how to do that exactly, without adding an extra line of something like Label value inside the config, as I see it redundant in this case.
Here’s the concept of it
Config = {}
Config.TestingShit = {
["test1"] = {
Position = vector3(976.6364,70.2947,115.1641),
DrawDistance = 50,
State = false,
},
['test2'] = {
Position = vector3(685.29, 569.65, 156.28),
DrawDistance = 50,
State = false,
}
}
Citizen.CreateThread(function()
while true do
Wait(500)
local pos = GetEntityCoords(PlayerPedId())
for k,v in pairs(Config.TestingShit) do
local distance = #(pos - v.Position)
local DrawDistance
if v.DrawDistance == nil then
DrawDistance = 500
else
DrawDistance = v.DrawDistance
end
if distance < DrawDistance then
if not v.State then
v.State = true
print(Config.TestingShit..' is visible') -- here's where I want to get the name of the whole table, such as "test1" or "test2"
end
else
if v.State then
v.State = false
--print(Config.TestingShit..' is INvisible')
end
end
end
end
end)
I’ll appreciate any advice on this, thank you!