Vehicle Types (MySQL)

Right, I'm revamping my vehicle system, and am wondering what I'm best off doing:

All's I have in my head at the minute would be to add in three fields into my vehicle table structure.

- FactionID (default value would be 0)
- GangID (default value would be 0)
- JobID (default value would be 0)
- Owned (default value would be 0)

Then if it's a faction vehicle for example, the value would be 1 (which is the faction id of LSPD) and the other 3 fields would then be 0.

Or is there a better and / or easier way to do this?

There's not really a better way to do it, they shouldn't ever conflict anyway. It's the way I do it.

EDIT: Sorry there is more than one way, but it involves storing all vehicles seperately, which creates 3 sets of problems instead of one.

You COULD define some "vehicle types" in your mode, that would save you from having 3 unnecessary fields. And you could have something like "possibleID" if the "vehicle type" is equivalent to something you would need to have an ID for...

So, would something like this suffice?

1) Owned Vehicle
2) Faction Vehicle
3) Gang Vehicle
4) Job Vehicle

This is what I was thinking:

pawn Код:
#define VEHICLE_TYPE_OWNED      1
#define VEHICLE_TYPE_JOB        1
#define VEHICLE_TYPE_GANG       1
But in a nutshell, yes.

Forum Jump:

Users browsing this thread: 1 Guest(s)