..:D&G:.. Posted June 1, 2016 Share Posted June 1, 2016 So I want to do quest thing where the players have to look and hit 150 pickups in order to use the command /getgift to get a gift... The problem is, I don't know the best way of storing each pickup to each player so that a player cannot use the same pickup twice. So yeah... I need a reliable and easy way to store all this in a MySQL database Link to comment
WhoAmI Posted June 1, 2016 Share Posted June 1, 2016 I don't think that MySQL database is necessary there. I think normal table will do the work. Something like local playerPickups = {} addEventHandler("onPickupHit", root, function(player) if isElement(player) and getElementType(player) == "player" then if not playerPickups[player] then playerPickups[player] = 1; else return; end else return; end end) Link to comment
..:D&G:.. Posted June 1, 2016 Author Share Posted June 1, 2016 Yeah but the thing is that there are 150 pickups, and if the player relogs or if the resource gets stoped, I want everything to be saved so that the player doesn't have to find all the pickups again Link to comment
WhoAmI Posted June 1, 2016 Share Posted June 1, 2016 So you can use databse there. I'll do the project for you. https://scr.hu/d3DoOe In 'pickup' you store all players, in 'player' you store all players which picked atleast one pickup and in 'player_pickup' you store id_player and what pickup he picked id_pickup. Link to comment
..:D&G:.. Posted June 1, 2016 Author Share Posted June 1, 2016 So you can use databse there. I'll do the project for you.https://scr.hu/d3DoOe In 'pickup' you store all players, in 'player' you store all players which picked atleast one pickup and in 'player_pickup' you store id_player and what pickup he picked id_pickup. So there is no efficient way of saving everything in only 1 table? Link to comment
WhoAmI Posted June 1, 2016 Share Posted June 1, 2016 Well, some way you will do that, but databse has to be optimalised and easy to read and get data. Link to comment
Axel Posted June 2, 2016 Share Posted June 2, 2016 Use pickup id's and save them in a table, and then use toJSON(table) to save them to a string, then in the database. Link to comment
WhoAmI Posted June 2, 2016 Share Posted June 2, 2016 That's the worst idea I've ever heard. That's not the way how we use database, c'mon. Link to comment
..:D&G:.. Posted June 2, 2016 Author Share Posted June 2, 2016 I've took your advice and made 2 separate tables for the pickups and for the pickups found by the player, thanks Link to comment
WhoAmI Posted June 2, 2016 Share Posted June 2, 2016 No problem. I've learned a lot about databases. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now