Simplest way around this?
#1

Quote:
Originally Posted by update
Player 1 buys vehicle A.
Vehicle A is given SAMP ID 1.
I save vehicle A and it is given MySQL ID 1.

So far so good. Stats save and load fine.

Player 2 spawns a temporary vehicle (Vehicle B) with a /veh command.
Vehicle B is given SAMP ID 2.
Because the vehicle is temporary and will disappear on a restart, no mysql ID is assigned.



Player 3 buys vehicle C.
Vehicle C is given SAMP ID 3.
I save vehicle C, but it is only given MySQL ID 2.

Now there's trouble. When trying to load vehicle C, the script loads the stats for MySQL ID 3 (which is non existent).
I'm working on my vehicle system, and I think I'm really over thinking an issue I'm stuck on. When a vehicle is bought, I insert a column to the MySQL table with the ID as an auto incrementing value. I save all vehicle stats by that ID, but that stops working when a vehicle is spawned by a source that isn't the dealership.

For example:
  • I buy a vehicle, it is assigned to ID 1.
    Vehicle 1 saves with MySQL ID 1.

  • Another vehicle is spawned with a /veh command. It is assigned (by samp) vehicle ID 2.

  • Another player buys a vehicle, with samp id 3, but when it saves that vehicle is only ID 2 in the MySQL table.
How should I work around this?
Reply


Messages In This Thread
Simplest way around this? - by zDevon - 02.01.2013, 03:29
Re: Simplest way around this? - by ReneG - 02.01.2013, 06:37
Re: Simplest way around this? - by zDevon - 02.01.2013, 10:31
Re: Simplest way around this? - by Threshold - 02.01.2013, 10:34
Re: Simplest way around this? - by shitbird - 02.01.2013, 10:40
Re: Simplest way around this? - by zDevon - 02.01.2013, 13:42
Re: Simplest way around this? - by zDevon - 02.01.2013, 21:42
Re: Simplest way around this? - by ReneG - 03.01.2013, 00:17
Re: Simplest way around this? - by zDevon - 03.01.2013, 01:11
Re: Simplest way around this? - by ReneG - 03.01.2013, 05:23

Forum Jump:


Users browsing this thread: 1 Guest(s)