Ulysses

Ulysses Stuff => General Chat & Help and Support => Topic started by: LuaTenshi on January 15, 2013, 12:03:19 AM

Title: Using Databases to store values such as money. (Tutorial Request)
Post by: LuaTenshi on January 15, 2013, 12:03:19 AM
Can some one make a good video tutorial about how to use databases to store values like money? (For both online and offline databases.)
Title: Re: Using Databases to store values such as money. (Tutorial Request)
Post by: MrPresident on January 15, 2013, 12:28:36 AM
Are you wanting to use the built in sv.db SQLite that is included in Gmod?

Or do you want something that you can tie into a website like MySQL?
Title: Re: Using Databases to store values such as money. (Tutorial Request)
Post by: LuaTenshi on January 15, 2013, 12:47:28 AM
Are you wanting to use the built in sv.db SQLite that is included in Gmod?

Or do you want something that you can tie into a website like MySQL?

Well I would like to use the sv.db, because all I really need to do is store money (scores), ...and I don't feel like I need an online scoreboard.

---

But it really depends on what is better, I need to store players scores, perks, and inventory items.
Title: Re: Using Databases to store values such as money. (Tutorial Request)
Post by: MrPresident on January 15, 2013, 05:07:13 AM
I'm not sure if this is new to GM13 or not (I've never seen it...)

but it certainly looks promising..

wiki.garrysmod.com/page/Classes/Player/GetPData
Title: Re: Using Databases to store values such as money. (Tutorial Request)
Post by: krooks on January 15, 2013, 09:36:50 AM
I was actually trying to do the same exact thing, I found this tutorial here: http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index69ca.html (http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index69ca.html)
and followed it, only changing some values like the name of the shop etc. but it wouldn't store the data, I'm wondering now if that's because the tutorial was for GM12.

There is also SetPData. My next question would be is, how do I create the "money" column? Would it auto create if I ran
player.GetByID( 1 ):SetPData( "money", 100 ) before trying to GetPData money?
Title: Re: Using Databases to store values such as money. (Tutorial Request)
Post by: MrPresident on January 15, 2013, 03:19:45 PM
Yes. You don't have to worry about setting anything up when using GetPData/SetPData. It will do all of the backend stuff for you.
Title: Re: Using Databases to store values such as money. (Tutorial Request)
Post by: krooks on January 16, 2013, 02:31:32 PM
Great, thanks for the info -- I could see this file getting a bit messy/overloaded? Is there some way to clean it out without deleting it completely?

Maybe that doesn't even matter?