[Need help] Loading objects in mysql
#1

I thought of trying out object and vehicle spawn loading from MySQL instead of scriptfiles. Would it even be much faster if loaded from MySQL?

And the problem here is that if I wanted to add objects from phpmyadmin, it would obviously have to be done 1 by 1 as we can only add 1 column at time. (?)
So if you can help me it'd be appreciated.
Reply
#2

I personally wouldn't. MySQL has its limits too and with loading all the objects it could mess some stuff up. I did this once with vehicles, I probably got it wrong but it did take me a long time to do the data entry and then it took me a long time to recovert the data back to .amx format. There's no point to be frankly honest, it's faster from the server loading it as the lines are right there; however if you're loading it from the MySQL database you'd have to retrieve the rows separately which is time consuming and unless you've got a newer version of MySQL it would take a longer amount of time. Therefore I'd say no, keep it how it is.
Reply
#3

It takes only a couple of minutes to restructure a bunch of CreateObject lines into a workable SQL query through creative use of Search and Replace. Assuming that the objects will be loaded in OnGameModeInit, the performance impact will be minimal. Yet you probably should only use a dynamic loading system if you intend to use and/or modify that information. For example a map editor, furniture editor, race builder or something like that.

Quote:
Originally Posted by DanishHaq
Посмотреть сообщение
MySQL has its limits too
I'd like you see hitting those with a simple SA-MP server. ******** uses MySQL, Wikipedia uses MySQL. It's built to handle millions of rows and thousands of tables.
Reply
#4

Solved:
Код:
CREATE TABLE IF NOT EXISTS `objects` (
  `ScriptID` int(10) NOT NULL AUTO_INCREMENT,
  `ModelID` int(10) NOT NULL,
  `X` float NOT NULL,
  `Y` float NOT NULL,
  `Z` float NOT NULL,
  `rX` float NOT NULL,
  `rY` float NOT NULL,
  `rZ` float NOT NULL,
  `Comment` varchar(30) NOT NULL,
  PRIMARY KEY (`ScriptID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

INSERT INTO `objects` (`ModelID`, `X`, `Y`, `Z`, `rX`, `rY`, `rZ`, `Comment`) VALUES
(985, 777.94189, -1330.17822, 14.25120,   0.00000, 0.00000, -1.00000, "Chicago Outfit");
Thanks btw.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)