..:D&G:.. Posted June 1, 2016 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
WhoAmI Posted June 1, 2016 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)
..:D&G:.. Posted June 1, 2016 Author 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
WhoAmI Posted June 1, 2016 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.
..:D&G:.. Posted June 1, 2016 Author 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?
WhoAmI Posted June 1, 2016 Posted June 1, 2016 Well, some way you will do that, but databse has to be optimalised and easy to read and get data.
Axel Posted June 2, 2016 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.
WhoAmI Posted June 2, 2016 Posted June 2, 2016 That's the worst idea I've ever heard. That's not the way how we use database, c'mon.
..:D&G:.. Posted June 2, 2016 Author 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
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