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

Wysłany: 2016-07-29, 16:51


OzikGames|YT

Skrypter LUA






Wiek: 26
Na forum: 3907 dni
Posty: 53
Nick w MP: OzikGames

Piwa: 749

Respekt: 50

Ostrzeżeń: 100%
Wygl?da to tak nie mog? si? zalogowa?
DB 3

http://imgur.com/a/zW47u

C_Logging

local sx,sy=guiGetScreenSize()
local data={ showed=nil, button={}, info=nil, misc=nil, }

function isMouseIn(psx,psy,pssx,pssy,abx,aby)
    if not isCursorShowing() then return end
    cx,cy=getCursorPosition()
    cx,cy=cx*sx,cy*sy
    if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
        return true,cx,cy
    else
        return false
    end
end

function renderLoginBox()
    dxDrawRectangle(sx*0/1024, sy*201/768, sx*1024/1024, sy*308/768, tocolor(0, 0, 0, 188), false)
    if data.info then dxDrawText(data.info, sx*252/1024, sy*232/768, sx*800/1024, sy*255/768, tocolor(237, 0, 0, 255), 1.00, "default", "center", "center", false) end
    dxDrawLine(sx*0/1024, sy*199/768, sx*1022/1024, sy*200/768, tocolor(31, 111, 193, 255), 5, false)
    dxDrawLine(sx*0/1024, sy*509/768, sx*1022/1024, sy*510/768, tocolor(31, 111, 193, 255), 5, false)
    dxDrawText("Our Stories", sx*0/1024, sy*157/768, sx*1024/1024, sy*237/768, white, 2.00, "pricedown", "center", "center", false)
    dxDrawText("U?ytkownik:", sx*256/1024, sy*272/768, sx*484/1024, sy*305/768, white, 1.00, "default-bold", "center", "center", false)
    dxDrawText("Has?o", sx*571/1024, sy*269/768, sx*799/1024, sy*302/768, white, 1.00, "default-bold", "center", "center", false)
    if not isMouseIn(sx*256/1024, sy*408/768, sx*226/1024, sy*45/768) then dxDrawRectangle(sx*256/1024, sy*408/768, sx*226/1024, sy*45/768, tocolor(35, 35, 35, 193), false)
    else dxDrawRectangle(sx*256/1024, sy*408/768, sx*226/1024, sy*45/768, tocolor(150, 0, 0, 193), false) end
    if not isMouseIn(sx*573/1024, sy*407/768, sx*226/1024, sy*45/768) then dxDrawRectangle(sx*573/1024, sy*407/768, sx*226/1024, sy*45/768, tocolor(35, 35, 35, 193), false)
    else dxDrawRectangle(sx*573/1024, sy*407/768, sx*226/1024, sy*45/768, tocolor(150, 0, 0, 193), false) end
    dxDrawText("Zaloguj si?", sx*255/1024, sy*408/768, sx*482/1024, sy*453/768, white, 1.00, "default", "center", "center", false)
    dxDrawText("Zarejestruj si?", sx*572/1024, sy*407/768, sx*799/1024, sy*452/768, white, 1.00, "default", "center", "center", false)
end

addEventHandler("onClientClick", root, function(btn,state)
    if btn=="left" and state=="down" then
        if isMouseIn(sx*256/1024, sy*408/768, sx*226/1024, sy*45/768) and data.showed then
            local login=guiGetText(data.button[1])
            local pass=guiGetText(data.button[2])
            if string.len(login) < 2 or string.len(pass) < 2 then
                data.info="Wype?nij wszystkie pola!"
                return
            end
            triggerServerEvent("logging:checkAccount", resourceRoot, login, pass)
        end
        if isMouseIn(sx*573/1024, sy*407/768, sx*226/1024, sy*45/768) and data.showed then
            local login=guiGetText(data.button[1])
            local pass=guiGetText(data.button[2])
            if string.len(login) < 2 or string.len(pass) < 2 then
                data.info="Wype?nij wszystkie pola!"
                return
            end
            if string.len(login) > 22 or string.len(pass) > 30 then
                data.info="Login/Has?o musi mie? mniej ni? 22/30 znak?w."
                return
            end
            triggerServerEvent("logging:newAccount", resourceRoot, login, pass)
        end
    end
end)

addEvent("logging:result", true)
addEventHandler("logging:result", resourceRoot, function(value,info)
    if not info then info="" end
    if value then
        data.showed=false
        showZones(data.misc)
        
        -- Usuwamy elementy
        destroyElement(data.button[1])
        destroyElement(data.button[2])
        removeEventHandler("onClientRender", root, renderLoginBox)
    else
        data.info=tostring(info)
        setTimer(function() data.info=nil end, 3000, 1)
    end
end)


addEventHandler("onClientResourceStart", resourceRoot, function()
    showChat(false)
    showCursor(true)
    fadeCamera(true)
    data.showed=true
    showPlayerHudComponent("all",false)
    setElementAlpha(localPlayer,0)
    data.misc=playSound("misc/intro.mp3",true)
    setSoundVolume(data.misc, 1.0)
    guiSetInputMode("no_binds_when_editing")
    setElementData(localPlayer,"status","Loguje si?")
    setElementData(localPlayer,"player:logged",false)
    addEventHandler("onClientRender", root, renderLoginBox)
    data.button[1]=guiCreateEdit(0.25, 0.41, 0.22, 0.05, "", true)
    data.button[2]=guiCreateEdit(0.56, 0.41, 0.22, 0.05, "", true)  
        guiEditSetMasked(data.button[2], true) 
end)


S_Logging

addEvent("onClientSendRegisterDataToServer", true)
addEventHandler("onClientSendRegisterDataToServer", getRootElement(), dodaj)
addEvent("logging:checkAccount", true)
addEventHandler("logging:checkAccount", resourceRoot, function(login,pass)
    local result=exports["og-db"]:getRekord("SELECT * FROM og_users WHERE login=?", login)
    if result and #result > 0 then
        if result[1].login == login and result[1].pass == md5(pass) then
            setPlayerName(client, login)
            setElementData(client, "player:uid", result[1].id)
            triggerClientEvent(client, "logging:result", resourceRoot, true, nil)
        else
            triggerClientEvent(client, "logging:result", resourceRoot, false, "Podane dane s? nieprawid?owe.")
        end
    else
        triggerClientEvent(client, "logging:result", resourceRoot, false, "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"]:getRekord("SELECT * FROM og_users WHERE login=?", login)
    if result and #result > 0 then
        triggerClientEvent(client, "logging:result", resourceRoot, false, "Podany login ju? istnieje w bazie.")
    else
        local query=exports["og-db"]:setRekord("INSERT INTO og_users (login,pass) VALUES (?,?)", login, md5(pass))
        if query then
            triggerClientEvent(client, "logging:result", resourceRoot, false, "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 (source, pozycja,90.0,0)
fadeCamera(source, false)
end)


function setCameraOnPlayerJoin()
     fadeCamera(source, true, 5)
     setCameraMatrix(source, 1254.14, 155.18, 66.37)
     spawnPlayer ( source, 0.0, 0.0, 5.0, 90.0, 0 )
end
addEventHandler("onPlayerJoin", getRootElement(), setCameraOnPlayerJoin)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-29, 21:47


Michaler







Wiek: 26
Na forum: 3939 dni
Posty: 77

Piwa: 1011

Respekt: 65,3

baza danych uzupe?niona? tabele s??

Podpis
~~~~ NIE ODPOWIADAM NA ŻADNE KOMENTARZE ~~~~
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-30, 02:00


OzikGames|YT

Skrypter LUA






Wiek: 26
Na forum: 3907 dni
Posty: 53
Nick w MP: OzikGames

Piwa: 749

Respekt: 50

Ostrzeżeń: 100%
Michaler, S?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-30, 12:25


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4979 dni
Posty: 915

Piwa: 2697

Respekt: 955,3
Respekt: 955,3Respekt: 955,3

Albo nie widze, albo nigdzie nie ma funkcji 'dodaj' lub jej nie doda?e? tutaj na gtao.
masz taki folder jak og-db? i czy w folderze og-db w pliku meta.xml jest linijka:

export function="getRekord" type="server"
??

Podpis
Jedyny kontakt ze mną to PW forum

Kod:


local noobs = getElementsByTitle("player", "Programista LUA")
for k, v in ipairs(noobs) do
outputChatBox("Bez mózgu jest użytkownik o nicku: "..getPlayerName(v), root)
destroyElement(v)
end
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-30, 21:49


OzikGames|YT

Skrypter LUA






Wiek: 26
Na forum: 3907 dni
Posty: 53
Nick w MP: OzikGames

Piwa: 749

Respekt: 50

Ostrzeżeń: 100%
Jurandovsky, Nie mam dodaje

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-30, 21:52


mixLoLmix2

Programista






Wiek: 35
Na forum: 4254 dni
Posty: 454
Nick w MP: TomeQmix

Piwa: 1915

Respekt: 47,3


addEvent("onClientSendRegisterDataToServer", true)
addEventHandler("onClientSendRegisterDataToServer", getRootElement(), dodaj)
addEvent("logging:checkAccount", true)
addEventHandler("logging:checkAccount", resourceRoot, function(login,pass)
    local result=exports["ogrpg-db"]:getRekord("SELECT * FROM ogrpg_users WHERE login=?", login)
    if result and #result > 0 then
        if result[1].login == login and result[1].pass == md5(pass) then
            setPlayerName(client, login)
            setElementData(client, "player:uid", result[1].id)
            triggerClientEvent(client, "logging:result", resourceRoot, true, nil)
        else
            triggerClientEvent(client, "logging:result", resourceRoot, false, "Podane dane s? nieprawid?owe.")
        end
    else
        triggerClientEvent(client, "logging:result", resourceRoot, false, "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["ogrpg-db"]:getRekord("SELECT * FROM ogrpg_users WHERE login=?", login)
    if result and #result > 0 then
        triggerClientEvent(client, "logging:result", resourceRoot, false, "Podany login ju? istnieje w bazie.")
    else
        local query=exports["ogrpg-db"]:setRekord("INSERT INTO ogrpg_users (login,pass) VALUES (?,?)", login, md5(pass))
        if query then
            triggerClientEvent(client, "logging:result", resourceRoot, false, "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 (source, pozycja,90.0,0)
fadeCamera(source, false)
end)


function setCameraOnPlayerJoin()
     fadeCamera(source, true, 5)
     setCameraMatrix(source, 1254.14, 155.18, 66.37)
     spawnPlayer ( source, 0.0, 0.0, 5.0, 90.0, 0 )
end
addEventHandler("onPlayerJoin", getRootElement(), setCameraOnPlayerJoin)


Zle cos tu da?es chyba :) M?wilismy o tym

Podpis
Zajmuję się pisaniem zaawansowanych skryptów lua na zamówienie za bardzo niską cene.
Oraz pomoc przy serwerze mta/forum i tym podobnych.
Discord: TomeQmix#7106
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-07-30, 21:53


OzikGames|YT

Skrypter LUA






Wiek: 26
Na forum: 3907 dni
Posty: 53
Nick w MP: OzikGames

Piwa: 749

Respekt: 50

Ostrzeżeń: 100%
mixLoLmix2, Dzia?a Piwo I repka]

Zamknij kto?

Postaw piwo autorowi tego posta
 

 
Tagi: panel :: logowanie :: 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 » Panel Logowanie 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