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

Wysłany: 2016-08-06, 21:27


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4149 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8

addEvent("onClientSendRegisterDataToServer"true)
addEventHandler("onClientSendRegisterDataToServer"getRootElement(), dodaj)
addEvent("logging:checkAccount"true)
addEventHandler("logging:checkAccount"resourceRoot, function(login,pass)
    local result=exports["og-db"]:dbGet("SELECT * FROM og_users WHERE login=?"login)
    if result and #result > 0 then
        if result[1].login == login and result[1].pass == md5(passthen
            setPlayerName(clientlogin)
            setElementData(client"player:uid"result[1].id)
            triggerClientEvent(client"logging:result"resourceRoottruenil)
        else
            triggerClientEvent(client"logging:result"resourceRootfalse"Podane dane s? nieprawid?owe.")
        end
    else
        triggerClientEvent(client"logging:result"resourceRootfalse"Podany login nie istnieje w bazie.")
    end
end)
addEvent("onClientSendRegisterDataToServer"true)
addEventHandler("onClientSendRegisterDataToServer"getRootElement(), dodaj)
addEvent("logging:newAccount"true)
addEventHandler("logging:newAccount"resourceRoot, function(login,pass)
    local result=exports["og-db"]:dbGet("SELECT * FROM og_users WHERE login=?"login)
    if result and #result > 0 then
        triggerClientEvent(client"logging:result"resourceRootfalse"Podany login ju? istnieje w bazie.")
    else
        local query=exports["og-db"]:dbSet("INSERT INTO og_users (login,pass) VALUES (?,?)"loginmd5(pass))
        if query then
            triggerClientEvent(client"logging:result"resourceRootfalse"Pomy?lnie zalogowa?e?(a?) si?")
        end
    end
end)

addEvent("core:spawnPlayer"true)
addEventHandler("core:spawnPlayer"resourceRoot, function()
local pozycja getElementData (source"player:spawn")
spawnPlayer (sourcepozycja,90.0,0)
fadeCamera(sourcefalse)
end)


function setCameraOnPlayerJoin()
     fadeCamera(sourcetrue5)
     setCameraMatrix(source1254.14155.1866.37)
     spawnPlayer source0.00.05.090.0)
end
addEventHandler("onPlayerJoin"getRootElement(), setCameraOnPlayerJoin)


Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-06, 21:32


Sekllik

owner - newRPG






Wiek: 25
Na forum: 4233 dni
Posty: 23
Nick w MP: Sekllik

Piwa: 139

Respekt: 12

Ostrzeżeń: 20%
"marcin778" napisał/a:

addEvent("onClientSendRegisterDataToServer"true)
addEventHandler("onClientSendRegisterDataToServer"getRootElement(), dodaj)
addEvent("logging:checkAccount"true)
addEventHandler("logging:checkAccount"resourceRoot, function(login,pass)
    local result=exports["og-db"]:dbGet("SELECT * FROM og_users WHERE login=?"login)
    if result and #result > 0 then
        if result[1].login == login and result[1].pass == md5(passthen
            setPlayerName(clientlogin)
            setElementData(client"player:uid"result[1].id)
            triggerClientEvent(client"logging:result"resourceRoottruenil)
        else
            triggerClientEvent(client"logging:result"resourceRootfalse"Podane dane s? nieprawid?owe.")
        end
    else
        triggerClientEvent(client"logging:result"resourceRootfalse"Podany login nie istnieje w bazie.")
    end
end)
addEvent("onClientSendRegisterDataToServer"true)
addEventHandler("onClientSendRegisterDataToServer"getRootElement(), dodaj)
addEvent("logging:newAccount"true)
addEventHandler("logging:newAccount"resourceRoot, function(login,pass)
    local result=exports["og-db"]:dbGet("SELECT * FROM og_users WHERE login=?"login)
    if result and #result > 0 then
        triggerClientEvent(client"logging:result"resourceRootfalse"Podany login ju? istnieje w bazie.")
    else
        local query=exports["og-db"]:dbSet("INSERT INTO og_users (login,pass) VALUES (?,?)"loginmd5(pass))
        if query then
            triggerClientEvent(client"logging:result"resourceRootfalse"Pomy?lnie zalogowa?e?(a?) si?")
        end
    end
end)

addEvent("core:spawnPlayer"true)
addEventHandler("core:spawnPlayer"resourceRoot, function()
local pozycja getElementData (source"player:spawn")
spawnPlayer (sourcepozycja,90.0,0)
fadeCamera(sourcefalse)
end)


function setCameraOnPlayerJoin()
     fadeCamera(sourcetrue5)
     setCameraMatrix(source1254.14155.1866.37)
     spawnPlayer source0.00.05.090.0)
end
addEventHandler("onPlayerJoin"getRootElement(), setCameraOnPlayerJoin)


Zmienili?my to ale wywala warningi: http://imgur.com/a/SmAwV

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-06, 21:40


OskarYT

Mapper MTA






Wiek: 26
Na forum: 4245 dni
Posty: 267
Nick w MP: Kaczorek2306

Piwa: 1230

Respekt: 85,3

marcin778, To co kolega Sekllik, m?wi ja mam tak samo :/

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-06, 21:43


Virelox







Wiek: 28
Na forum: 4814 dni
Posty: 156
Nick w MP: Virelox

Piwa: 623

Respekt: 120,5
Respekt: 120,5

Po raz kolejny rozwi?zanie problemu jest proste, w ostrze?eniach wida? ?e nie ma po??czenia z baz? danych, i patrz?c do zasobu to faktycznie dane do bazy s? ale nie ma nawi?zania po??czenia :D



function connectDatabase()
    connect dbConnect("mysql""dbname="..DBName..";host="..DBHost..";port=3306, DBUser, DBPass)
    if connect then 
        outputDebugString("Polaczono z baza danych.", 3)
    else 
        outputDebugString("Blad polaczenia z baza danych.", 1)
    end 
end 
addEventHandler("onResourceStart", resourceRoot, connectDatabase)


@Edit pope?ni?em ma?y b??d poniewa? w argumencie do nazwy bazy danych u?y?em nazwe u?ytkownika, kod zosta? poprawiony.

Ostatnio zmieniony przez Virelox 2016-08-06, 21:52, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-06, 21:44


OskarYT

Mapper MTA






Wiek: 26
Na forum: 4245 dni
Posty: 267
Nick w MP: Kaczorek2306

Piwa: 1230

Respekt: 85,3

Virelox, co ja mam zrobi? z tym co napisa?e? da? do panelu czy db ? :D

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-06, 21:45


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4149 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8


Więcej informacji znajdziesz w Wikipedii MTA:

dbConnect


Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-06, 21:46


Virelox







Wiek: 28
Na forum: 4814 dni
Posty: 156
Nick w MP: Virelox

Piwa: 623

Respekt: 120,5
Respekt: 120,5

Do tego zasobu z baz? danych musisz to doda?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-06, 21:46


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4149 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8

Do DB

Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-06, 21:51


OskarYT

Mapper MTA






Wiek: 26
Na forum: 4245 dni
Posty: 267
Nick w MP: Kaczorek2306

Piwa: 1230

Respekt: 85,3

gdy doda?em ju? to :

DBHandler=nil
DBName="db_18100"
DBUser="db_18100"
DBPass="haslo"
DBHost="mysql-ols1.ServerProject.pl"

function connectDatabase()
    connect dbConnect("mysql""dbname="..DBUser..";host="..DBHost..";port=3306, DBUser, DBPass")
    if connect then 
        outputDebugString("Polaczono z baza danych."3)
    else 
        outputDebugString("Blad polaczenia z baza danych."1)
    end 
end 
addEventHandler("onResourceStart"resourceRootconnectDatabase)


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

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


to zacze?y wyskakiwa? ERROR'y
oto ss :
http://imgur.com/a/jHab9

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-06, 21:54


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4149 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8

Nie poda?e? has?a do bazy danych przez co niema dost?pu

Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-06, 21:55


Virelox







Wiek: 28
Na forum: 4814 dni
Posty: 156
Nick w MP: Virelox

Piwa: 623

Respekt: 120,5
Respekt: 120,5


dbConnect("mysql",?"dbname="..DBName.."; host="..DBHost.."; port=3306",?DBUser,?DBPass)


Ostatnio zmieniony przez Virelox 2016-08-06, 22:00, w całości zmieniany 2 razy  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-06, 21:55


OskarYT

Mapper MTA






Wiek: 26
Na forum: 4245 dni
Posty: 267
Nick w MP: Kaczorek2306

Piwa: 1230

Respekt: 85,3

marcin778, has?o jest wpisane tam gdzie pisze has?o jest wpisane has?o prawdziwe tylko nie chcia?em si? nim dzieli? tutaj :/

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-06, 21:58


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4149 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8


function connectDatabase()
connect dbConnect("myslq","dbname="db_18100";host=mysql-ols1.ServerProject.pl""db_18100""haslo","shade=1")
    if connect then 
        outputDebugString("Polaczono z baza danych."3)
    else 
        outputDebugString("Blad polaczenia z baza danych."1)
    end 
end 
addEventHandler("onResourceStart"resourceRootconnectDatabase)


Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-06, 22:01


Virelox







Wiek: 28
Na forum: 4814 dni
Posty: 156
Nick w MP: Virelox

Piwa: 623

Respekt: 120,5
Respekt: 120,5

Zamie? linijk? na ten kod co ci podam


dbConnect("mysql",?"dbname="..DBName.."; host="..DBHost.."; port=3306",?DBUser,?DBPass)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-06, 22:05


OskarYT

Mapper MTA






Wiek: 26
Na forum: 4245 dni
Posty: 267
Nick w MP: Kaczorek2306

Piwa: 1230

Respekt: 85,3

teraz jest co? takiego na tym kodzie :
-- Settings
DBHandler=nil
DBName="db_18100"
DBUser="db_18100"
DBPass="...."
DBHost="mysql-ols1.ServerProject.pl"


function connectDatabase()
dbConnect("mysql""dbname="..DBName.."; host="..DBHost.."; port=3306"DBUserDBPass)
    if connect then 
        outputDebugString("Polaczono z baza danych."3)
    else 
        outputDebugString("Blad polaczenia z baza danych."1)
    end 
end 
addEventHandler("onResourceStart"resourceRootconnectDatabase)

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

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


Oto SS co wywala : http://imgur.com/a/L7OVg

Podpis
Ostatnio zmieniony przez OskarYT 2016-08-06, 22:09, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Tagi: our-game :: logowanie
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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