Best way to store information?

Hey! I am making Pointshop, but there you can buy ranks for my server and now i am interested, which are the best ways to store information? Like SteamID and Points? Itself pointshop uses files, i think about mysql, is there others? Which is fastest? Which is the most efficient (Uses less resources) and Easiest to use (Less lines)?

Thank you!

MySQL requires more lines but would be worth it in the long run.
Storing a table (using file.Write() util.TableToJSON()) would require the least amount of lines, though it’s arguably slower and less efficient than MySQL.

If you want purchasable ranks it may be better to use MySQL as you’d be able to link a paypal buy button on your website, which would subsequently directly interface with this MySQL.

Remove .html for .lua file: – File example; using an index file to increment file names without overwriting any if you delete any. Don’t delete the index. This should help out with basic file operations:

Database tutorials:

Using both MySQLOO and TMySQL in a fallback setup:

MySQL OO by itself

TMySQL by itself.

Covers some basic SQL queries; commented out but hopefully I provide enough explanation for them to make sense. Different methods for inserting.

With databases, you need to understand that you can’t do a query and RETURN a value inside the query function. You need to use callbacks because of the amount of “time” it takes to execute the query. Even though it is fast, and when loaded into memory can be much faster than fileio, it still requires a callback. Do NOT use the SQL Wait function to force the function to wait in order to be able to return; this can cause a noticeable lag / stutter in game-play.

With files, you can return from a file.Read function.

I am like making in-game just, like every build i give some points, and then you can buy own rank, i am thinking now about files because i tested sql, and i had big problems, i just have to load number and the file name would be steam id but : replaced to _.

EDIT: Is there other ways? I think it is possible to do from php code to sql, but anyone then can set points, which makes it a problem.

Why not write it so it is open-ended. Use a wrapper to store and retrieve data?

For the MySQL, to retrieve, first time you’d load into memory; subsequent times you’d read from memory. To save you’d update the table.

For Files, to retrieve, first time you’d load into memory; subsequent times you’d read from memory. To save, you’d write to the file.

For SQLite, … same stuff…

Make sure you NEVER trust the client… Never accept net messages from a client telling the server how many points to add, etc… The server adds points, removes points, etc ( manages it ), and networks the result to the client.

I runned now to a problem, i made folder “points” where are players points by their steam id : replaced to _, but i need to get the points to my derma and i dont get it how, i dont know how in clientside i get an player so i could get the files information and now i think theres problem in clientside as you have to get servers data/points and not possibly clients (Not sure about this) you have any example? Or tip?

The best you’re looking for is probably PData. It’s saved via SQLite onto a single file on the server, you can view it with a SQLite editor. If you want to put it into a SQL database however, you’re going to have to use the MySQL Module.
Hope I helped!

Yeah, this is the probably best, got already that suggestion from steam, but thanks still!

[editline]20th June 2014[/editline]