hahec Posted February 16, 2012 Posted February 16, 2012 Hello all. Could someone explain what MySQL Database actually is/is for. Ty.
Castillo Posted February 16, 2012 Posted February 16, 2012 https://wiki.multitheftauto.com/wiki/Mysql
drk Posted February 16, 2012 Posted February 16, 2012 You can store data in MySQL, like saving player settings instead of saving in the account. Example: local connection = mysql_query("CREATE TABLE IF NOT EXISTS Settings ( player TEXT, money NUMBER )") addEventHandler('onPlayerJoin',root, function() local name = getPlayerName(source) local select = mysql_query("SELECT money WHERE player = '"..name.."'") if #select == 0 then result = mysql_query("INSERT INTO Settings VALUES ( player = '"..name.."', money = '"..tonumber(0).."' )") outputChatBox('New in the server? Good! Your money is 0. If you have any problem contact administrators!',source,255,255,255,false) else outputChatBox('Your money is: $'..select[1]['money'],source,255,255,255,false) end end)
Castillo Posted February 16, 2012 Posted February 16, 2012 I suggest you to use the new DB functions instead, as far as I know, they are better, and easier to use (at least for me). https://wiki.multitheftauto.com/wiki/DbConnect
hahec Posted February 16, 2012 Author Posted February 16, 2012 Ok tnx both. So i will have to use DB functions for login system? and things like that? or am i wrong?
drk Posted February 16, 2012 Posted February 16, 2012 You can, but you can use MTA default account system too.
Castillo Posted February 16, 2012 Posted February 16, 2012 Yes, you can create a MySQL login system with the DB functions.
hahec Posted February 16, 2012 Author Posted February 16, 2012 Hmm...i see. So i've made that login GUI from wiki. Introduction to the GUI. So could you make a tip to make that login Working? tnx.
Castillo Posted February 16, 2012 Posted February 16, 2012 There are examples in the wiki, just read them and learn how to do it.
drk Posted February 16, 2012 Posted February 16, 2012 And start learning this too: http://www.lua-users.org/wiki/TutorialDirectory
Agon Posted February 17, 2012 Posted February 17, 2012 What is difference between using MySQL and player account in order to save player data?
drk Posted February 17, 2012 Posted February 17, 2012 Using MySQL you save the data in a data base like web-servers mysql. Using player account it will save in registry.db or internal.db ( I don't remember ). Then, you can lose it if you reinstall the server or delete any configuration server, but if you use MySQL you will only need to connect to the database
Agon Posted February 18, 2012 Posted February 18, 2012 Using MySQL you save the data in a data base like web-servers mysql.Using player account it will save in registry.db or internal.db ( I don't remember ). Then, you can lose it if you reinstall the server or delete any configuration server, but if you use MySQL you will only need to connect to the database oh thank you
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