Creating Personal Vehicle via MySQL and ZCMD
#5

Just add an 'ID' column with the auto-increment enabled to your table and set that as primary key.
Each time someone buys a vehicle, you just insert a new row into your database and MySQL will automatically increase the ID by 1, giving every vehicle a truely unique ID.
After inserting the new vehicle, use "cache_insert_id" to get the newly created ID for that vehicle and store it in your enum.

Note that this ID isn't the same as the ingame vehicleid used by all vehicle-functions.
It's only a value to reference the vehicle in the database, you can't use it with SAMP's vehicle-functions.
Vehicleid's ingame range from 1 to 1999, but the ID in your database goes from 1 to 2 billion.
Vehicleid's ingame will be re-used when a vehicle is removed from the world and re-created afterwards, the ID in the database will never be used again.
Reply


Messages In This Thread
Creating Personal Vehicle via MySQL and ZCMD - by Zeus666 - 14.04.2018, 13:34
Re: Creating Personal Vehicle via MySQL and ZCMD - by Mugala - 14.04.2018, 22:22
Re: Creating Personal Vehicle via MySQL and ZCMD - by Zeus666 - 15.04.2018, 07:29
Re: Creating Personal Vehicle via MySQL and ZCMD - by TitoRayne - 15.04.2018, 11:22
Re: Creating Personal Vehicle via MySQL and ZCMD - by AmigaBlizzard - 15.04.2018, 14:26

Forum Jump:


Users browsing this thread: 1 Guest(s)