Do you think this Suitcase system will work? (Mysql Tables)
#1

Hello,

I am making a suitcase system so that you can store guns in your suitcase...then you can /drop suitcase (create pickup of the suitcase) or /give suitcase [playerid] and anything else i can think of... I am thinking that the best way to do this is first of all making a new table for "suitcases" and each suitcase gets stored in there... i would use these fields:
Код:
ID (primary Key, protocol) - Suitcase ID (6 digit number) - Slot1 - Slot2 - etc...
Now, the ID will be the primary key, and its always important to have this so that it doesnt get repeated...although i will ALSO use a suitcase ID, although this will not be primary...Instead i will script it so when you "buy" a suitcase, it will make a new record and it will generate a new 6 digit ID and give this record that ID, but it will check through the DB first, and if it already exsists, it will get another random number.... This will not be Primary key for the table because the primary key is goin to be auto Incremented (AutoNumber)..


Now, the slot1, slot2, will just be either GunSlot1, GunSlot2 etc... or GunMaterials1, Drugs1....etc, i can add these as my server progresses...

The last thing i need to do is add a field to the accounts table caled... "suitcaseID", this will be the 6 digit number of the case you are holding, so you know which one is yours...

---
thats pretty much whole thing, i might of missed a few points out /...but overall, does this seem like a smart system?? here are a few more points:

() Will be sure that if a case has been dropped as a pickup and is not picked up by the time the server restarts or something, the script (under OnGameModeExit) will reconize this and wipe the record...
() Maybe a Owner field in the table for the suitcase... Dont really think that i need it, but might need it?
Reply
#2

Quote:

() Will be sure that if a case has been dropped as a pickup and is not picked up by the time the server restarts or something, the script (under OnGameModeExit) will reconize this and wipe the record...

Do you ask if the case will save after server restart? Ofcourse if you create a table with x y z coordinates and other fields and update every time when there's something changed about that case. and then load all suitcases in tables for example "enum scInfo" ( it will be faster than loading straight from mysql )
Reply
#3

Yeahh, i will use enum anyway, just didnt mention it...

and i wont need X Y Z because the pickup will disapear if someone doesnt pick it up (i will probs make like a 10 minute timer on it or something)..

I just meant by that, if case is dropped on the floor (in pickup form) and the gamemode exited, or something... i would remove the record...

---

So, yeah.. I wont be saving X Y Z... and i was already goin to use enum... just was thinking about the table itself and theory behind the system...

I think it will work great! you think it looks okay?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)