Jump to content

MySQL Database.


hahec

Recommended Posts

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) 

Link to comment

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 :)

Link to comment
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 :)

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...