Reading a .txt file to make sub-menus and vehicle spawns

I am making a menu that will spawn cars that are available on the server. The person running the server can at any point put down, in a given text file, the id of the car, the car name, and what sub-menu it is being put inside of. I have made something where a menu opens and cars can spawn, but that requires going inside the code, changing some stuff around, etc. I am making it for the text file.

Way it would look in the text file.

spawnCode: Name of Car: Submenu

Here is the issue I am having. The only way I think I am able of doing this is by making 3 text files, split each one and putting them into an array, and then sending them to another method, in which it would add a car based on what is put in the first line of each text file. Doing this sounds like it would be tedious for the person running the server. Is there any way I can make it so it can read the same file, split them up, and make it it would make submenus or make the car appear in the menu in any way?

Thank you…

You could just use tables.

You can also use LOAD_RESOURCE_FILE https://runtime.fivem.net/doc/natives/#_0x76A9EE1F and/or the json library

3 Likes