SA-MP Forums Archive
MySQL numbering per player - 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: MySQL numbering per player (/showthread.php?tid=418554)



MySQL numbering per player - dusk - 25.02.2013

I am trying to create a vehicle system. And i want player to be able to have more than 1 car.
My question: is it possible to make auto numeration for every player? That there would be 1,2,3 for everyone. Because increment just numbers for everyone.
Hope you understood


Re: MySQL numbering per player - Vince - 25.02.2013

Create a table for vehicles if you haven't already. Create a combined primary key, consisting of the userid that's in your player's table (use foreign keys) and the auto_increment vehicleid from the vehicle's table. Then your table could look something like:

useridvehicleidmodel
11522
12402
23600



Re: MySQL numbering per player - dusk - 25.02.2013

Okay...i thought i understand,but i don't. How do i create a combined primary key?

EDIT. How do i create a foreign key? Once again i think i understood how to do else.


Re: MySQL numbering per player - dusk - 25.02.2013

bump


Re: MySQL numbering per player - dusk - 25.02.2013

How do i set a foreign key on already existing tables?


Re: MySQL numbering per player - Misiur - 25.02.2013

Easiest way would be with pma - add index key, then switch to relative view and add foreign key


Re: MySQL numbering per player - dusk - 25.02.2013

could you eplain it slower ?


Re: MySQL numbering per player - Misiur - 25.02.2013

phpMyAdmin - if you are working on your computer, I can assume that you are running WAMP/XAMPP or something like this so it should be included by default. Also almost every webhosting has it


Re: MySQL numbering per player - dusk - 25.02.2013

I use webhosting. What is relative view?


Re: MySQL numbering per player - dusk - 26.02.2013

bump