• Need LUA Help
    0 replies, posted
Hey guys, I have a few things I need help with, first is I've looked around for a guide about MySQLoo but have seen none. If someone could point me in the right direction to read more in detail about using it, I would greatly appreciate it. The second thing is getting a onConnect command to work that when a new player joins, it adds them to my MySQL database. Here is what I have right now, and I get no error (which I guess means that the connection was successful ? ) but nothing is put into the table. [code] FruzzLink.Data = {} FruzzLink.Data.MySQL = {} FruzzLink.Data.MySQL.DBOBJ = false function FruzzLink.Data.MySQL:Connect(callbackfunc) if !self.DBOBJ then self.DBOBJ = mysqloo.connect(DATABASE_HOST, DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_NAME, DATABASE_PORT) local oldCall = self.DBOBJ.onConnected if oldCall then self.DBOBJ.onConnected = function(db) oldCall(db) callbackfunc(db) end else self.DBOBJ.onConnected = function(db) callbackfunc(db) end end self.DBOBJ.onConnectionFailed = function(db, err) print(db, "connection failed", err) end self.DBOBJ:connect() else local status = self.DBOBJ:status() if status == 1 then local oldCall = self.DBOBJ.onConnected self.DBOBJ.onConnected = function(db) callbackfunc(db) oldCall(db) end elseif status == 2 then local oldCall = self.DBOBJ.onConnected self.DBOBJ.onConnected = function(db) callbackfunc(db) oldCall(db) end self.DBOBJ:connect() else callbackfunc(self.DBOBJ) end end end function FruzzLink.Data.MySQL:User(ply, callback) if ply:IsValid() then self:Connect(function(db) local query1 = db:query(string.format("INSERT INTO USER_TABLE (name, steamID, userGroup, coins, lastvisit, playtime) VALUES (%q, %q, 'guest', 0, UNIX_TIMESTAMP(), 0)", db:escape(ply:Nick()), ply:SteamID())) query1.onSuccess = function() self:GetLink(ply, callback) end query1:start() end) end end[/code] Thank you for taking time to help me out :)
Sorry, you need to Log In to post a reply to this thread.