Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require("mysqloo")
- local ServerName = "ProjectRP - Development"
- local DATABASE_HOST = "127.0.0.1"
- local DATABASE_PORT = 3306
- local DATABASE_NAME = "dynamiceffect_config"
- local DATABASE_USERNAME = "dynamiceffect"
- local DATABASE_PASSWORD = "3uyXKLDUGWeQKUQX"
- database = mysqloo.connect(DATABASE_HOST, DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_NAME, DATABASE_PORT)
- function connect()
- database.onConnected = print("Connected to Mysql DB")
- database.onConnectionFailed = function() print( "MySQL connection failed" ) end
- database:connect()
- end
- function query(Q,Call)
- doquery = 0
- doquery = database:query( Q )
- doquery:setOption(mysqloo.OPTION_CACHE,true)
- doquery.onError = function(Q,E) print(E) end
- doquery.onSuccess = function()
- if type( Call ) != "function" then return end
- Call( doquery:getData() )
- end
- doquery:start()
- end
- function GetServerName(data)
- local NewServerName = data[1]["Value"]
- NewServerName = string.gsub(NewServerName,"<servername>",ServerName)
- RunConsoleCommand("hostname",NewServerName)
- print("Changing Server Name to "..NewServerName)
- end
- function SqlQuery()
- print("Doing Mysql Query")
- mysql.query("SELECT * FROM dynamiceffect_config WHERE Name = 'Servername'",GetServerName)
- end
- SqlQuery()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement