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

Wysłany: 2016-10-29, 20:48


Kacper11252







Wiek: 36
Na forum: 3566 dni
Posty: 2
Nick w MP: KacperJestem



Respekt: 50

m?g? by mi kto? wyt?umaczy? jak po?onczyc mysql z serwerem mta?
lub jak by m?g? kto? poda? swoje skype i mi to wyt?umaczy? za pomoc stawiam :piwo: :D

Komentarz Shimeon dodany 2016-10-29, 20:48Pomagamy tylko na forum
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-10-29, 20:50


_Wicek_

Majstersztyk






Wiek: 25
Na forum: 4260 dni
Posty: 747
Nick w MP: Wicek

Piwa: 1841

Respekt: 360,5
Respekt: 360,5Respekt: 360,5Respekt: 360,5Respekt: 360,5

Ostrzeżeń: 40%

Więcej informacji znajdziesz w Wikipedii MTA:

dbConnect


Podpis

Support-Team: 25.01.2016
Moderator: 10.07.2016




GG: 51274621
Skype : kuba_wicinski
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-10-29, 21:03


Kacper11252







Wiek: 36
Na forum: 3566 dni
Posty: 2
Nick w MP: KacperJestem



Respekt: 50

chodzi mi o wyt?umaczenie krok po kroku ?eby kto? napisa?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-10-31, 01:00


KubasGC







Wiek: 29
Na forum: 4199 dni
Posty: 10
Nick w MP: Kubas

Piwa: 2

Respekt: 60

1. Musisz posiada? serwer MTA.
2. Musisz posiada? serwer MySQL (MariaDB te? ujdzie).
3. Musisz posiada? odpowiednie uprawnienia na serwerze MySQL umo?liwiaj?ce po??czenie serwera z baz? (nie po??czy? swojego lokalnego serwera z baz? danych z cba.pl dla przyk?adu, bo serwery nie s? ustawione na listowanie ?wiata - kwestie bezpiecze?stwa).
4. Gdy to ju? wszystko masz to u?ywasz funkcji dbConnect, kt?ra zosta?a podana @UP.
5. Wszystko gra.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-11-01, 22:19


Artystek







Wiek: 23
Na forum: 3520 dni
Posty: 143
Nick w MP: Artystek

Piwa: 74

Respekt: 55,3


--[[
    ResourceOURGame v2
    DevelopersSplit <split.programista@gmail.com>
    You have no right to use this code without my permission.
    (c2015 <split.programista@gmail.com>. All rights reserved.
]]

-- Settings
-- Settings
DBHandler=nil
DBName="TU WPISZ NAZW? BAZY DANYCH"
DBUser="TU WPISZ NAZW? U?YTKOWNIKA BAZY DANYCH"
DBPass="TU WPISZ HAS?O DO BAZY DANYCH" 
DBHost="TU WPISZ ADRES BAZY DANYCH"

-- Functions
function dbSet(...)
    if not {...} then return end
    local stringe=dbPrepareString(DBHandler,...)
    local query=dbExec(DBHandlerstringe)
    return query
end

function dbGet(...)
    if not {...} then return end
    local stringe=dbPrepareString(DBHandler,...)
    local query=dbQuery(DBHandlerstringe)
    local result=dbPoll(query, -1)
    return result
end


addEventHandler("onResourceStart"resourceRoot, function()
    DBHandler=dbConnect("mysql""dbname="..DBName..";host="..DBHost..""DBUserDBPass"share=1;autoreconnect=1")
    if DBHandler then
        outputDebugString("* Connect to server MYSQL...")
        dbSet("SET NAMES utf8")
    else
        outputDebugString("* No Connecting to server MYSQL..")
    end
end)


local SQL_LOGIN="TU WPISZ NAZW? U?YTKOWNIKA BAZY DANYCH"
local SQL_PASSWD="TU WPISZ HAS?O DO BAZY DANYCH"
local SQL_DB="TU WPISZ NAZW? BAZY DANYCH"
local SQL_HOST="TU WPISZ ADRES BAZY DANYCH"
local SQL_PORT=3306

local root getRootElement()

local SQL

local function connect()
    SQL mysql_connect(SQL_HOSTSQL_LOGINSQL_PASSWDSQL_DBSQL_PORT) 
    if (not SQLthen
        outputServerLog("BRAK POLACZENIA Z BAZA DANYCH!")
    else
        mysql_query(SQL,"SET NAMES utf8")
        outputServerLog("Modul mysql polaczony!")
    end

end


local function keepAlive()
    if (not mysql_ping(SQL)) then
        outputServerLog("Zerwane polaczenie z baza danych, nawiazywanie...")
        connect()
    end
end
addEventHandler("onResourceStart",getResourceRootElement(),function()
    connect()
    setTimer(keepAlive300000)
end)

function esc(value)
    return mysql_escape_string(SQL,value)
end

function pobierzTabeleWynikow(query)
    local result=mysql_query(SQL,query)
    if (not resultthen
        outputDebugString("mysql_query failed: (" .. mysql_errno(SQL) .. ") " .. mysql_error(SQL))
        outputServerLog("mysql_query failed: (" .. mysql_errno(SQL) .. ") " .. mysql_error(SQL))
        return nil
    end
    local tabela={}
    for result,row in mysql_rows_assoc(result) do
        table.insert(tabela,row)
    end
    mysql_free_result(result)
    return tabela
end

function pobierzWyniki(query)
    local result=mysql_query(SQL,query)
    if (not resultthen return nil end
    row mysql_fetch_assoc(result)
    mysql_free_result(result)
    return row
end


function zapytanie(query)
    local result=mysql_query(SQL,query)
    if (resultthen mysql_free_result(result) return true end
    return
end

function insertID()
    return mysql_insert_id(SQL)
end

function affectedRows()
    return mysql_affected_rows(SQL)
end


function fetchRows(query)
    local result=mysql_query(SQL,query)
    if (not resultthen return nil end
    local tabela={}

    while true do
        local row mysql_fetch_row(result)
        if (not rowthen break end
        table.insert(tabela,row)
    end
    mysql_free_result(result)
    return tabela
end


function getSQLLink()
    return SQL
end


Uzupe?nij miejsca, w kt?rych wyst?puj? du?e litery. Kod z paczki Our Game - Your Adventure.

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
ka1356
Tagi: jak :: podłonczyć :: serwer :: mta :: mysql.
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Jak podłonczyć serwer mta z mysql. Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

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