[ESX] How to get multiple Vectors in table form into the vector3 format in the client.lua | Invalid Vector Type

Hello, i have a problem with vectors in my script.

I need to create multiple locations (Changeble in the Config file) , for the ESX.Game.Utils.DrawText3D function from ESX.

I have a Config file, where I created a “table” with multiple vector3 coordinates ( 1. Screenshot) . when I am calling those in the client.lua with the ESX.Game.Utils.DrawText3D(vector3…) (2. Screenshot) function it gives me this error: (3. Screenshot) because - i think - that the multiple vector format from the created table is not working. Even with the ESX.DumpTable it is not working.

Maybe there is a diffrent way to use multiple vectors in the Config file to create multiple DrawText3D locations. I hope I can get help

best regards

Here are the Screenshots

InteractCoords is a table. You’re trying to have it draw things at a table and that wont work.

Ok, do you maybe know a diffrent way, to get those vectors out of the table? Or to use multiple vector3 coords for the variable ?

Either run it thru a loop or call it directly by key.

erther run it thru a aloop or call it directly by key

so you can do it like this:

config.lua:

Config.Task = {

[1] = {

    InteractionCoords = {

        {coords = vector3(-72.000000, 2320.602295, 150.379517)}, 

        {coords = vector3(1287.138428, 1804.153809, 85.423462)}

    }
}

}

client.lua

for k, v in pairs(Config.Task[1].InteractionCoords) do

        local player = PlayerPedId()

        local pedCoords = GetEntityCoords(player)

        local dist = GetDistanceBetweenCoords(pedCoords, v.coords, true) 


        if dist <= 5 then 
            ESX.Game.Utils.DrawText3D(v.coords, "TEST", 1.0, 1)
        end


    end
1 Like

Thanks, that worked, good to know for the Future !