09.09.2013, 22:48
Alright.
Imagine a Database structure. (Skipping details.)
ID INT;
PlayerName VARCHAR;
PlayerWeapon1 INT;
PlayerWeapon2 INT;
PlayerWeapon3 INT;
Instead of that, so there isn't many rows, I can have:
ID INT;
PlayerName VARCHAR;
PlayerWeapon INT;
Create new combinations IDs such as:
Weapon 1 = 1
Weapon 2 = 2
Weapon 3 = 4
Then to save Weapon 1, Weapon 2, Weapon 3 I save it into the database as ID 7 (1 + 2 + 4 = 7).
But when I load the ID of the weapon, I want to give them the correct weapon, so I need to check if Weapon 2 is in that variable.
I've seen this done before I'm not really sure where, I understand it, it's like binary.
Imagine a Database structure. (Skipping details.)
ID INT;
PlayerName VARCHAR;
PlayerWeapon1 INT;
PlayerWeapon2 INT;
PlayerWeapon3 INT;
Instead of that, so there isn't many rows, I can have:
ID INT;
PlayerName VARCHAR;
PlayerWeapon INT;
Create new combinations IDs such as:
Weapon 1 = 1
Weapon 2 = 2
Weapon 3 = 4
Then to save Weapon 1, Weapon 2, Weapon 3 I save it into the database as ID 7 (1 + 2 + 4 = 7).
But when I load the ID of the weapon, I want to give them the correct weapon, so I need to check if Weapon 2 is in that variable.
I've seen this done before I'm not really sure where, I understand it, it's like binary.