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

Wysłany: 2017-01-04, 18:50


MarkiusSK







Wiek: 31
Na forum: 3687 dni
Posty: 3
Nick w MP: Marek762001



Respekt: 50

Please help me, I have got 1 script where is everything from gamemode ( It is database :D ) and how to connect it with my database online ( dbadmin.sk I can give you password and you can do it please ) But when I click to IMPORT and take this file ERROR and when I click to database and copy this text there ERROR

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-01-04, 18:59


_Haze

Peace Yo!






Wiek: 24
Na forum: 4184 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

Is polish mta forum u could use https://forum.mtasa.com/ ,but i think is http://dbadmin.sk/ bug. U must call to support of this web.
This is script to sql connect and functions:
local SQL

local function connect()
    -- w ponizszej linii uzupelnij dane autoryzacji
    SQL dbConnect("mysql""dbname=xxx;host=xxx""xxx","xxx","share=1")
    if (not SQLthen
        outputServerLog("BRAK POLACZENIA Z BAZA DANYCH!")
    else
        outputDebugString("DB PASS")
        zapytanie("SET NAMES utf8;")
    end

end
addEventHandler("onResourceStart",resourceRootconnect)

function pobierzTabeleWynikow(...)
    local h=dbQuery(SQL,...)
    if (not hthen 
        return nil
    end
    local rows dbPoll(h, -1)
    return rows
end

function pobierzWyniki(...)
    local h=dbQuery(SQL,...)
    if (not hthen 
        return nil
    end
    local rows dbPoll(h, -1)
    if not rows then return nil end
    return rows[1]
end

function zapytanie(...)
    local h=dbQuery(SQL,...)
    local result,numrowslast_id=dbPoll(h,-1)
    return numrows
end

function zapytanieID(...)
    local h=dbQuery(SQL,...)
    local result,numrowslast_id=dbPoll(h,-1)
    return numrowslast_id
end

function update(...)
    local h=dbExec(SQL,...)
    return h
end

This is function to connect mysql database

Więcej informacji znajdziesz w Wikipedii MTA:

dbConnect


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-01-04, 19:20


MarkiusSK







Wiek: 31
Na forum: 3687 dni
Posty: 3
Nick w MP: Marek762001



Respekt: 50

I have got this -

DBHandler=nil
DBName="db_17749"
DBUser="db_17749"
DBPass="5dsfw3DdS" 
DBHost="mysql-fr1.ServerProject.pl"

-- 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="db_17749"
local SQL_PASSWD="5dsfw3DdS"
local SQL_DB="db_17749"
local SQL_HOST="mysql-fr1.ServerProject.pl"
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 

[ Dodano: 2017-01-04, 19:21 ]
And what I can do it with this and once the same too and where I can put this files

Ostatnio zmieniony przez luki123luki123 2017-01-04, 19:33, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-01-04, 19:30


_Haze

Peace Yo!






Wiek: 24
Na forum: 4184 dni
Posty: 1648
Nick w MP: Haze

Piwa: 2628

Respekt: 1020
Respekt: 1020

MarkiusSK, if u have in db3 (/debugscript 3) messageConnect to server MYSQL... then ur gamemode is connected :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-01-04, 19:34


MarkiusSK







Wiek: 31
Na forum: 3687 dni
Posty: 3
Nick w MP: Marek762001



Respekt: 50

Please can you visit my server ? Sorry for adding IP to forum but I need really help : CUT and password is 123 ( difficult :D )

[ Dodano: 2017-01-04, 19:49 ]
Please really please beacause I need help

[ Dodano: 2017-01-04, 20:21 ]
Ah okay and when I give you password and username to dbadmin.sk can you help me and finish it ?

[ Dodano: 2017-01-04, 21:34 ]
Ah okay and when I give you password and username to dbadmin.sk can you help me and finish it ?

[ Dodano: 2017-01-04, 21:35 ]
Ah okay and when I give you password and username to dbadmin.sk can you help me and finish it ?

Komentarz marcin778 dodany 2017-01-04, 20:17We help only for forum
Ostatnio zmieniony przez marcin778 2017-01-04, 20:18, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Tagi: mysql :: database
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » MySql database 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