Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2019-08-10, 11:04


Krzywy







Wiek: 35
Na forum: 3250 dni
Posty: 21



Respekt: 50

Zastosowa?em si? do poradnika gravgora lecz po wyjscu z deatchmatch nie mam zadnego x86.
Baza zosta?a podpi?ta i to nic nie zmienia, nadal jest sending.
Kod:

-- connection settings
local hostname = "94.23.90.14"
local username ="db_45775"
local password = "GjadushgGuadyDSGaijd"
local database = "db_45775"
local port = 3306

-- global things.
local MySQLConnection = nil
local resultPool = { }
local sqllog = false
local countqueries = 0
a
-- connectToDatabase - Internal function, to spawn a DB connection
function connectToDatabase(res)
MySQLConnection = mysql_connect(hostname, username, password, database, port)

if (not MySQLConnection) then
if (res == getThisResource()) then
cancelEvent(true, "Cannot connect to the database.")
end
return nil
end

return nil
end
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), connectToDatabase, false)

-- destroyDatabaseConnection - Internal function, kill the connection if theres one.
function destroyDatabaseConnection()
if (not MySQLConnection) then
return nil
end
mysql_close(MySQLConnection)
return nil
end
addEventHandler("onResourceStop", getResourceRootElement(getThisResource()), destroyDatabaseConnection, false)

-- do something usefull here
function logSQLError(str)
local message = str or 'N/A'
outputDebugString("MYSQL ERROR "..mysql_errno(MySQLConnection) .. ": " .. mysql_error(MySQLConnection))
exports['logs']:logMessage("MYSQL ERROR :O! [QUERY] " .. message .. " [ERROR] " .. mysql_errno(MySQLConnection) .. ": " .. mysql_error(MySQLConnection), 24)
end

function getFreeResultPoolID()
local size = #resultPool
if (size == 0) then
return 1
end
for index, query in ipairs(resultPool) do
if (query == nil) then
return index
end
end
return (size + 1)
end

------------ EXPORTED FUNCTIONS ---------------

function ping()
if (mysql_ping(MySQLConnection) == false) then
-- FUU, NO MOAR CONNECTION
destroyDatabaseConnection()
connectToDatabase(nil)
if (mysql_ping(MySQLConnection) == false) then
logSQLError()
return false
end
return true
end

return true
end

function escape_string(str)
if (ping()) then
return mysql_escape_string(MySQLConnection, str)
end
return false
end

function query(str)
if sqllog then
exports['logs']:logMessage(str, 24)
end
countqueries = countqueries + 1

if (ping()) then
local result = mysql_query(MySQLConnection, str)
if (not result) then
logSQLError(str)
return false
end

local resultid = getFreeResultPoolID()
resultPool[resultid] = result
return resultid
end
return false
end

function unbuffered_query(str)
if sqllog then
exports['logs']:logMessage(str, 24)
end
countqueries = countqueries + 1

if (ping()) then
local result = mysql_unbuffered_query(MySQLConnection, str)
if (not result) then
logSQLError(str)
return false
end

local resultid = getFreeResultPoolID()
resultPool[resultid] = result
return resultid
end
return false
end

function query_free(str)
local queryresult = query(str)
if not (queryresult == false) then
free_result(queryresult)
return true
end
return false
end

function rows_assoc(resultid)
if (not resultPool[resultid]) then
return false
end
return mysql_rows_assoc(resultPool[resultid])
end

function fetch_assoc(resultid)
if (not resultPool[resultid]) then
return false
end
return mysql_fetch_assoc(resultPool[resultid])
end

function free_result(resultid)
if (not resultPool[resultid]) then
return false
end
mysql_free_result(resultPool[resultid])
table.remove(resultPool, resultid)
return nil
end

-- incase a nub wants to use it, FINE
function result(resultid, row_offset, field_offset)
if (not resultPool[resultid]) then
return false
end
return mysql_result(resultPool[resultid], row_offset, field_offset)
end

function num_rows(resultid)
if (not resultPool[resultid]) then
return false
end
return mysql_num_rows(resultPool[resultid])

end

function insert_id()
return mysql_insert_id(MySQLConnection) or false
end

function query_fetch_assoc(str)
local queryresult = query(str)
if not (queryresult == false) then
local result = fetch_assoc(queryresult)
free_result(queryresult)
return result
end
return false
end

function query_rows_assoc(str)
local queryresult = query(str)
if not (queryresult == false) then
local result = rows_assoc(queryresult)
free_result(queryresult)
return result
end
return false
end

function query_insert_free(str)
local queryresult = query(str)
if not (queryresult == false) then
local result = insert_id()
free_result(queryresult)
return result
end
return false
end

function escape_string(str)
return mysql_escape_string(MySQLConnection, str)
end

function debugMode()
if (sqllog) then
sqllog = false
else
sqllog = true
end
return sqllog
end

function returnQueryStats()
return countqueries
-- maybe later more
end

Kod:

username = "db_45775"
password = "GjadushgGuadyDSGaijd"
db = "db_45775"
host = "94.23.90.14"
port = 3306

function getMySQLUsername()
return username
end

function getMySQLPassword()
return password
end

function getMySQLDBName()
return db
end

function getMySQLHost()
return host
end

function getMySQLPort()
return port
end



[ Dodano: 2019-08-10, 12:26 ]
Jeszcze podsylam mtaserver conf bo ko?cz? mi sie mo?liwo?ci i pomysly.
Prosze o szybk? pomoc, odwdziecze sie browarkiem i repka :)
https://www.upload.ee/fil...erver.conf.html

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-10-30, 17:31


kapi141206







Wiek: 26
Na forum: 3057 dni
Posty: 14



Respekt: 50

a na czym masz host?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-10-30, 22:26


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Nie wiem jak pozostali, ale ja nic nie zrozumia?em z tego opisu problemu.
Jaki poradnik gravgora? Nie ka?dy musi go zna? na pami??. Sw?j problem opisz w taki spos?b:
pr?buje podpi?? baz? danych z serwerem MTA:SA ale nie mog? u?y? odpowiedniej funkcji etc.

W FileZilli widnieje nazwa u?ytkownika "s45774" a w kodzie u?ywasz "db_45775". To mo?e u?yj tej jeden poprawnej. Upewnij si? te? czy port, has?o i host si? zgasza.

Postaw piwo autorowi tego posta
 

 
Tagi: nie :: działa :: podpiecie :: bazy :: owl
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Nie działa podpiecie bazy OWL Odpowiedz do tematu

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku