I'm working on a shop that uses its own currency and at the moment every time I need to access the balance of a user I make a call to the database I know this is not the best practice. I'm not sure how I would store it for use while the player is on the server. Any ideas on how I could?
Pretty sure the way you're doing is the most secure and not that bad practice? I take it you're using an external database not a local database i.e just a DB file?
correct I'm using mysqloo. I wasn't sure if the way I was doing it was bad or if there was a better way to handle the data instead of making a call to the database every time I needed it.
Make sure you're storing your currency as an integer, in its lowest possible denomination.
For example, if you're trying to store how much USD someone has, and they have $50.35, you might be tempted to store their balance as 50.35.
Instead, you should store it as 5035. This way you will never have floating-point precision errors.
I'm pretty sure the way you're doing is fine. At least you're not storing it in a text-file. Next thing to do now is create a website and show the user's coins on the website B)
Sorry, you need to Log In to post a reply to this thread.