dbQuery(function(qh, player, username, md5password) local a, b, c = dbPoll(qh, 0) if b > 0 then outputChatBox(\"Neked már van accountod\") regisztalhat = false return end end, {player,username,md5password}, mysql:connectToDb(), \"SELECT * FROM accounts WHERE username=\'\" .. username .. \"\' AND cked = 0\") dbQuery(function(qh, player, username, md5password) local result, rows, errorMsg = dbPoll(qh, 0) if not regisztalhat then return end if rows > 0 then outputChatBox(\"Ez a név foglalt\") else local _, id = mysql:query_free(\"INSERT INTO accounts SET serial = \'\".. serial ..\"\', username = \'\"..tostring(username)..\"\', password = \'\"..tostring(md5password)..\"\'\", true) outputChatBox(\"Sikeres regisztáció\") end end, {player,username,md5password}, mysql:connectToDb(), \"SELECT * FROM accounts WHERE username = ? LIMIT 1\", username) [/quote] function getSQLData() return \"dbname=mta;host=localhost\", \"root\", \"\", \"share=0\" end function connectToDb() local mysqlConnect = dbConnect(\"mysql\",getSQLData()) if not (mysqlConnect) then outputDebugString(\"Nem tudtam csatlakozni a MYSQL-hez.\") else outputDebugString(\"Sikeresen csatlakoztam a MYSQL-hez.\") end end addEventHandler(\"onResourceStart\", getResourceRootElement(getThisResource()), connectToDb, false) function query_free(str) local queryresult = query(str) if not (queryresult == false) then free_result(queryresult) return true end return false end function free_result(resultid) if (not resultPool[resultid]) then return false end mysql_free_result(resultPool[resultid]) table.remove(resultPool, resultid) table.remove(queryPool, resultid) return nil end function fetch_assoc(resultid) if (not resultPool[resultid]) then return false end return mysql_fetch_assoc(resultPool[resultid]) end function escape_string(str) if (str) then return str end return false end [/quote] [2017-10-01 12:05:22] WARNING: mta_login\\s_login.lua:22: Bad argument @ \'dbQuery\' [Expected db-connection at argument 3, got nil][2017-10-01 12:05:22] INFO: Sikeresen csatlakoztam a MYSQL-hez.[2017-10-01 12:05:22] WARNING: mta_login\\s_login.lua:31: Bad argument @ \'dbQuery\' [Expected db-connection at argument 3, got nil]
function getSQLData() return \"dbname=mta;host=localhost\", \"root\", \"\", \"share=0\" end function connectToDb() local mysqlConnect = dbConnect(\"mysql\",getSQLData()) if not (mysqlConnect) then outputDebugString(\"Nem tudtam csatlakozni a MYSQL-hez.\") else outputDebugString(\"Sikeresen csatlakoztam a MYSQL-hez.\") end end addEventHandler(\"onResourceStart\", getResourceRootElement(getThisResource()), connectToDb, false) function query_free(str) local queryresult = query(str) if not (queryresult == false) then free_result(queryresult) return true end return false end function free_result(resultid) if (not resultPool[resultid]) then return false end mysql_free_result(resultPool[resultid]) table.remove(resultPool, resultid) table.remove(queryPool, resultid) return nil end function fetch_assoc(resultid) if (not resultPool[resultid]) then return false end return mysql_fetch_assoc(resultPool[resultid]) end function escape_string(str) if (str) then return str end return false end [/quote] [2017-10-01 12:05:22] WARNING: mta_login\\s_login.lua:22: Bad argument @ \'dbQuery\' [Expected db-connection at argument 3, got nil][2017-10-01 12:05:22] INFO: Sikeresen csatlakoztam a MYSQL-hez.[2017-10-01 12:05:22] WARNING: mta_login\\s_login.lua:31: Bad argument @ \'dbQuery\' [Expected db-connection at argument 3, got nil]
Nem, másik szerver(nyugi nem akarok szervert nyitni, csak gyakorlok)