SA-MP Forums Archive
Making CAR system [MySQL] [Save Cars] - 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: Making CAR system [MySQL] [Save Cars] (/showthread.php?tid=360166)



Making CAR system [MySQL] [Save Cars] - dasto_fantasto - 16.07.2012

Evening,

I am making CAR system with Mysql i made that you can buy car and insert into MySQL information.
UNIQUE ID CARD ID and so on...
But how to know which car belongs to me? i confused becouse all cars ID's are the same.
For example buffalo ID 402 so if i buy buffalo ID will be 402 and if buffalo buy my friend ID will be same (402)
Can annyone help me to figure out how to make cars and players identification.
Like when i enter my bought car it would show message you have entered your bought car when my friend will enter car he will get message that he entered his car not when i enter message show to me and to my friend.


THANK YOU GOOD PEOPLE


Re: Making CAR system [MySQL] [Save Cars] - Infinity90 - 16.07.2012

Well, you will need to show us your code. We can not do anything without Code or Errors / Warnings.


Re: Making CAR system [MySQL] [Save Cars] - leonardo1434 - 16.07.2012

Just stock their cars into their personal file's, instead of make it as a global,therefore you'll just have to check in their own files if he is the real one, otherwise remove it from the car.

i have no idea how to do it in mysql, cause i had never tried before, but soon as possible when i learn feel tips i'll able to move on to next step.


Re: Making CAR system [MySQL] [Save Cars] - showarn - 04.07.2013

Mysql Table

Код:
CREATE TABLE IF NOT EXISTS `cars` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `Model` int(11) NOT NULL,
  `LocationX` float NOT NULL,
  `LocationY` float NOT NULL,
  `LocationZ` float NOT NULL,
  `Angle` float NOT NULL,
  `Color1` int(11) NOT NULL,
  `Color2` int(11) NOT NULL,
  `Owner` text NOT NULL,
  `Description` text NOT NULL,
  `Value` int(11) NOT NULL,
  `License` text NOT NULL,
  `Owned` int(11) NOT NULL,
  `Lock` int(11) NOT NULL,
  `Mod0` int(11) NOT NULL,
  `Mod1` int(11) NOT NULL,
  `Mod2` int(11) NOT NULL,
  `Mod3` int(11) NOT NULL,
  `Mod4` int(11) NOT NULL,
  `Mod5` int(11) NOT NULL,
  `Mod6` int(11) NOT NULL,
  `Mod7` int(11) NOT NULL,
  `Mod8` int(11) NOT NULL,
  `Mod9` int(11) NOT NULL,
  `Donate` int(11) NOT NULL,
  `Fuel` int(11) NOT NULL,
  `TrunkWeapon1` int(11) NOT NULL,
  `TrunkAmmo1` int(11) NOT NULL,
  `TrunkWeapon2` int(11) NOT NULL,
  `TrunkAmmo2` int(11) NOT NULL,
  `TrunkWeapon3` int(11) NOT NULL,
  `TrunkAmmo3` int(11) NOT NULL,
  `TrunkWeapon4` int(11) NOT NULL,
  `TrunkAmmo4` int(11) NOT NULL,
  `TrunkArmour` float NOT NULL,
  `TrunkCounter` int(11) NOT NULL,
  `Alarm` int(11) NOT NULL,
  `TrunkDrugs` int(11) NOT NULL,
  `TrunkMats` int(11) NOT NULL,
  `Impounded` int(11) NOT NULL,
  `ImpoundedPrice` int(11) NOT NULL,
  `Insurance` int(11) NOT NULL,
  PRIMARY KEY (`ID`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2023 ;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;



Re: Making CAR system [MySQL] [Save Cars] - Vince - 04.07.2013

You need to link it to the player table. I'll take you have auto increment ids for your player's table as well. Store those ids in Pawn when loading and use it whenever you need to fetch some player related data from different tables.