Storing player data? (Names,Money, ect.)

Howdy lads and lasses, am planning on doing a little bit of Game mode scripting as a learning experience and I am wondering how i would go about storing player data on the game mode such as money and such.

Thanks in advance

The easy way.

and how would i go about loading that playerdata back out onto the player?

PData is the lazy and poor way of doing it. If you want to learn SQL, you are able to use SQLite, or you can store it by .txt files.

If you insist on using PData, it’s GetPData.

If you’re interested:
http://wiki.garrysmod.com/page/Category:file (for files)
http://wiki.garrysmod.com/page/Category:sql (for using gmod’s database)

Better use SqlLite or txt files.But SQLLite is the best way. Because your server already has a database. So you can use sql commands to create table and insert data and update data. A lot of things. But need SQL knowledge

good tools and places to start.
The maurits.tv is a good tutorial although they use a weird function called QueryValue and I don’t understand why they don’t use the result table the Select statement returns. If there is an error, result will return false, else, it’ll return a table that contains rows, if any returned.

ex:



local result = sql.Query("SELECT * FROM memes WHERE quality = 'dank'")
PrintTable(result[1]) -- first row of data
PrintTable(result[2]) -- seond row of data (if exists)
print(result[1]['somecolumn']) -- prints the column value of row 1
print(result[1].somecolumn) -- same as above