Nikolay_888 Posted July 31, 2015 Share Posted July 31, 2015 Hello. I want to learn to use MTA-MySQL module. In the forum, I searched this topic: viewtopic.php?f=148&t=42067&hilit=mysql But the topicstarter write: This is outdated. It is recommended you use the internal db* functions instead Is this tutorial not actual? I don't searched no more tutorials about MTA-MySQL. So how to learn this module? I don't want to use db functions, because I read that it is slow (with big amount of query). Thank you Link to comment
JR10 Posted July 31, 2015 Share Posted July 31, 2015 Check this one: viewtopic.php?f=148&t=38203#p393074 Link to comment
Nikolay_888 Posted July 31, 2015 Author Share Posted July 31, 2015 Check this one: viewtopic.php?f=148&t=38203#p393074 But this is SQLite Link to comment
GTX Posted July 31, 2015 Share Posted July 31, 2015 It is MySQL also. Set first argument to "mysql". There are examples on wiki. dbConnect -- Example from wiki: test_db = dbConnect("mysql", "dbname=frank;host=1.2.3.4", "username", "password", "share=1") Link to comment
Nikolay_888 Posted July 31, 2015 Author Share Posted July 31, 2015 Ok, thank you guys. And what about this: MySQLConnection mysql_connect ( string hostname, string username, string password, string database, [ int port=3306, string unix_socket=nil, string client_flags=""] ) Is it the same thing? Link to comment
GTX Posted August 1, 2015 Share Posted August 1, 2015 You need module, but that module might be outdated. I'd prefer DB functions. Link to comment
Nikolay_888 Posted August 1, 2015 Author Share Posted August 1, 2015 Ok, thank you, I decided to use db functions. But I have new question: Why need to use elementData for players, if there is a database? For example: I need to save a value of player money. There is a column 'money' in the db 'players'. On server starts, it connects to db. Then player join to the server, with setPlayerMoney I set value from db. Then player spend his money, we use setPlayerMoney and set new value into db. Link to comment
JR10 Posted August 1, 2015 Share Posted August 1, 2015 The scenario you mentioned is okay with the flow you suggested. Now imagine play time, there are no native functions to manipulate play time. Are you going to query the database each time the play time is updated? I hope not. You can use element data as a session storage, when the player leaves, you can get the element data and save it into an SQL database. You can also use tables instead of element data, with each player as the key, it's more efficient this way. Link to comment
Nikolay_888 Posted August 1, 2015 Author Share Posted August 1, 2015 Ok, i understood, thank you! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now