Custom Config Files for a Loadout system, need help!

Hello, I have been trying to understand how I can set up a config system for my loadout addon.

What I am trying to do is, have a list of weapons in a config file, with a custom name and corresponding entity name.
And also a custom loadout file for each player that changes his loadout.

I’ve set up in my mind that every weapon has 3 entries:
1 - Unique ID
2 - Name (string)
3 - Entity Name (ex: weapon_smg1)

and every player in their file has the three weapons of different category (1 primary, 1 secondary, 1 special), so the player file would include 3 IDs which are then used by a spawn handler to give out to the player on respawn.

example: 1,5,7
and my handler would check in with the weapons config, find what the entity names of weapon 1, 5 and 7 are and give them to the player.

I already have a user interface for weapon selection, that uses 3 different "DListView"s for each catagory, but I dont know how to set up the DListView items to be automatically generated by reading the server’s config file.

So the things I need help with are:
1 - How to write and read a custom config file.
2 - How to fill in a DListView with items from a custom config file from the server.

-snip- sorry, I didn’t read the whole part.

  1. You can either use sql database or txt files to store that info.

I’d rather use txt files to begin with, but I am not sure as to where to start with the reading and writing part to the txt files, and more confusing part for me is how I will do the 2nd part to retrieve the list of available weapons

[editline]19th March 2014[/editline]

I suppose I can use File/Read and break down strings but I need to find an effective way to distinguish every element of every entry, if I can do that, all my problems will go away but for now I am open to ideas.

You can turn tables into a string using util.JSONtoTable and util.TableToJSON to convert it back and forth.

ow, that sounds cool, I will check it out, thanks man!

No problem.

-snip- dont mind this

/thread