SA-MP Forums Archive
Vehicle Types (MySQL) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Vehicle Types (MySQL) (/showthread.php?tid=584446)



Vehicle Types (MySQL) - Luis- - 04.08.2015

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?


Re: Vehicle Types (MySQL) - Dokins - 04.08.2015

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.


Re: Vehicle Types (MySQL) - Scenario - 04.08.2015

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...


Re: Vehicle Types (MySQL) - Luis- - 04.08.2015

So, would something like this suffice?

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


Re: Vehicle Types (MySQL) - Scenario - 04.08.2015

This is what I was thinking:

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