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

Wysłany: 2016-03-27, 13:04


CzarnaKobra







Wiek: 30
Na forum: 4324 dni
Posty: 59
Nick w MP: CzarnaKobra

Piwa: 1

Respekt: 45,3

Witam Posiadam Panel logowania wszystko cacy po??czone z mysql ale jest jedna wada nie loguje ./login haslo czyli po wejsciu na serwer musz? pisa? login haslo.
Potrzebuje linijki/Porady by to zrobi?


Pierwszy:


function OnPlayerJoin()
fadeCamera(source, true)
createBlipAttachedTo(source, 0, 2, 255, 255, 255)
outputChatBox("Witaj na serwerze [Nazwa serwera]!", source, 255, 255, 255, true)
spawnPlayer(source, -2031.4154, 174.5885, 28.8359, nil, 0, 0, 1)
setCameraMatrix( source, -1997.4337158203, 200.27589416504, 51.115345001221, -2015.9968261719, 183.58070373535, 37.68424987793 )
end
addEventHandler("onPlayerJoin", getRootElement(), OnPlayerJoin)

function PlayerQuit()
local attached = getAttachedElements(source)
if (attached) then
    for k,v in ipairs(attached) do
        if getElementType(v) == "blip" then
            destroyElement(v)
        end
    end
end
end
addEventHandler("onPlayerQuit", getRootElement(), PlayerQuit)

-- Funkcja logowania
function loginPlayer(login, haslo)
if not (login == "") then
    if not (haslo == "") then
        local account = getAccount(login, haslo)
        if ( account ~= false ) then
            logInn = logIn (source, account, haslo)
            if logInn then
                spawnn()
                outputChatBox ("Zosta?e? zalogowany na konto: #00FF00"..login.."#FFFFFF, mi?ej gry :)", source, 255, 255, 255, true)
                triggerClientEvent(source, "RPG:EventClient", getRootElement(), "zalogowano")
                setElementData(source, "zalogowany", true)
            else
                outputChatBox ("Ooops, co? posz?o nie tak :/ Spr?buj ponownie.", source, 255, 0, 0, true)
            end
        else
            outputChatBox ("Podany login lub has?o jest b??dny", source, 255, 0, 0, true)
        end
    else
        outputChatBox ("#FF0000*#FFFFFF Prosz? wpisa? Has?o!", source, 255, 255, 255, true)
    end
else
    outputChatBox ("#FF0000*#FFFFFF Prosz? wpisa? Login!", source, 255, 255, 255, true)
end
end
addEvent("onLoginPlayer", true)
addEventHandler("onLoginPlayer", getRootElement(), loginPlayer)

-- Funkcja Rejestracji Konta
function registerPlayer(login, haslo, haslo2)
if not (login == "") then
    if not (haslo == "") then
        if not (haslo2 == "") then
            if haslo == haslo2 then
                local account = getAccount(login,haslo)
                if (account == false) then
                    local accountAdded = addAccount(login, haslo)
                    if (accountAdded) then
                        triggerClientEvent(source, "RPG:EventClient", getRootElement(), "zarejestrowano")
                        outputChatBox ("#00FF00*#FFFFFF Rejestracja zako?czy?a si? pomy?lnie! [Login: #00FF00"..login.." #00FF00| #FFFFFFHas?o: #00FF00"..haslo.."#FFFFFF]", source, 255, 255, 255, true)
                        outputChatBox("#00FF00*#FFFFFF Mo?esz zalogowa? si? na nowe konto.", source, 255, 255, 255, true)
                    else
                        outputChatBox ("#FF0000*#FFFFFF B??D! Prosz? wpisa? inny login", source, 255, 255, 255, true)
                    end
                else
                    outputChatBox ("#FF0000*#FFFFFF B??D! Konto z takim Loginem ju? istnieje!", source, 255, 255, 255, true)
                end
            else
                outputChatBox ("#FF0000*#FFFFFF B??D! Podane has?a nie sa indentyczne!", source, 255, 255, 255, true)
            end
        else
            outputChatBox ("#FF0000*#FFFFFF B??D! Prosz? potwierdzi? has?o!", source, 255, 255, 255, true)
        end
    else
        outputChatBox ("#FF0000*#FFFFFF B??D! Prosz? wpisa? login!", source, 255, 255, 255, true)
    end
else
    outputChatBox ("#FF0000*#FFFFFF B??D! Wprowadz login, kt?ry chcesz zarejestrowa?!", source, 255, 255, 255, true)
end
end
addEvent("onRegisterPlayer", true)
addEventHandler("onRegisterPlayer", getRootElement(), registerPlayer)


-- Funkcja kt?ra sprawi ?e kolor twojej wiadomo?ci b?dzie w kolorach Teamu
function Chat(message, msgtype)
    local Gracz = getPlayerName(source)
    if (msgtype == 0) then
    cancelEvent()
    local red, green, blue = getPlayerNametagColor(source)
    outputChatBox(""..Gracz..": "..message, root, red, green, blue, true)
end
end
addEventHandler("onPlayerChat", root, Chat)


function spawnn()
    setPlayerTeam(source, getTeamFromName("Cywile"))
    setElementInterior(source, 0 )
    setElementDimension(source, 0 )
    fadeCamera( source, false )
    toggleAllControls( source, false )
    setTimer(setElementDimension, 1000, 1, source, 0)
    setTimer(fadeCamera, 2000, 1, source, true )
    setTimer(toggleAllControls, 2000, 1, source, true )
    setTimer(setCameraTarget, 2000, 1, source)
end

function startRPG()
for id, v in ipairs(getElementsByType("player")) do
    setPlayerTeam(v, getTeamFromName("Cywile"))
    createBlipAttachedTo(v, 0, 2, 255, 255, 255)
end
end
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), startRPG)





Drugi:


--[[
    Resource: OURGame v2
    Developers: Split <split.programista@gmail.com>
    You have no right to use this code without my permission.
    (c) 2015 <split.programista@gmail.com>. All rights reserved.
]]

addEvent("logging:checkAccount", true)
addEventHandler("logging:checkAccount", resourceRoot, function(login,pass)
    local result=exports["ogrpg-db"]:dbGet("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?&#8230; nieprawid?&#8218;owe.")
        end
    else
        triggerClientEvent(client, "logging:result", resourceRoot, false, "Podany login nie istnieje w bazie.")
    end
end)

addEvent("logging:newAccount", true)
addEventHandler("logging:newAccount", resourceRoot, function(login,pass)
    local result=exports["ogrpg-db"]:dbGet("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"]:dbSet("INSERT INTO ogrpg_users (login,pass) VALUES (?,?)", login, md5(pass))
        if query then
            triggerClientEvent(client, "logging:result", resourceRoot, false, "Pomy?&#8250;lnie zalogowa?&#8218;e?&#8250;(a?&#8250;) si?&#8482;")
        end
    end
end)



To chyba tyle

Ostatnio zmieniony przez #404 2016-03-27, 14:49, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-27, 18:27


AteX







Wiek: 27
Na forum: 4157 dni
Posty: 925
Nick w MP: #AteX

Piwa: 8366

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

Nie loguje przez /login bo ten panel logowania jest na mysql, a nie standardowe logowanie MTA.
Jak chcesz, aby logowa?o ci? te? w standardowy spos?b dopisz do logowania

Więcej informacji znajdziesz w Wikipedii MTA:

logIn


Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-27, 21:46


CzarnaKobra







Wiek: 30
Na forum: 4324 dni
Posty: 59
Nick w MP: CzarnaKobra

Piwa: 1

Respekt: 45,3

AteX czy jeste? w stanie jako? pom?c? czyli wklei? tu edytowany ten kod?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-28, 22:00


mixLoLmix2

Programista






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

Piwa: 1915

Respekt: 47,3

function PlayerLogin(username,password,checksave)
if not (username == "") then
if not (password == "") then
local account = getAccount ( username,password )
if ( account ~= false ) then
logIn(source, account, password)
setPlayerName(source,username)
triggerClientEvent (source,"statygracza",getRootElement())
                        setCameraTarget(source, source)
                    outputChatBox ("Gratulacje! Zalogowa?e? si? poprawnie! Potrzebujesz Tax?wki? napisz Potrzebuje Taxi Miejsce Pewnie kto? przyjedze :)")
                triggerClientEvent (source,"Zacznij",getRootElement())
                toggleControl (source, "fire", false)
                triggerClientEvent (source,"statygracza",getRootElement())
                toggleControl (source, "aim_weapon", false)
            end
        end
    end
end                        
addEvent("onRequestLogin",true)
addEventHandler("onRequestLogin",getRootElement(),PlayerLogin)


function registerPlayer(username,password,passwordConfirm)
    if not (username == "") then
        if not (password == "") then
                    local account = getAccount (username,password)
                    if (account == false) then
                        local accountAdded = addAccount(tostring(username),tostring(password))
                        if (accountAdded) then
                            triggerClientEvent (source, "Zaloguj", root, source)
                        else
                            triggerClientEvent( source, "Konto_jest", root, source)                        
                        end
                    else
                        triggerClientEvent ( source, "Nick_Konto", root, source)
                    end
        else
            triggerClientEvent ( source, "Brak_Haslo", root, source)
        end
    else
        triggerClientEvent (source, "nick", root, source)
        end
        end
                                               
        
addEvent("onRequestRegister",true)
addEventHandler("onRequestRegister",getRootElement(),registerPlayer)


function playerLogin( thePlayer )
end
addEventHandler("onPlayerLogin", getRootElement(), playerLogin)

function playerJoin( thePlayer )
spawnPlayer(thePlayer,1,1,1,0)
end
addEventHandler("onPlayerJoin", getRootElement(), playerLogin)


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-03-29, 09:36


AteX







Wiek: 27
Na forum: 4157 dni
Posty: 925
Nick w MP: #AteX

Piwa: 8366

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

@up ale mu pomog?e?... poda?e? zupe?nie inny kod na logowanie i teraz nie b?dzie ??czy? si? z MySQL.

To powinno dzia?a?:
--[[
    Resource: OURGame v2
    Developers: Split <split.programista@gmail.com>
    You have no right to use this code without my permission.
    (c) 2015 <split.programista@gmail.com>. All rights reserved.
]]

addEvent("logging:checkAccount", true)
addEventHandler("logging:checkAccount", resourceRoot, function(login,pass)
    local result=exports["ogrpg-db"]:dbGet("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
            local account = getAccount(login,pass)
            if account then
                logIn(client,login,pass)
            end
            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?&#8230; nieprawid?&#8218;owe.")
        end
    else
        triggerClientEvent(client, "logging:result", resourceRoot, false, "Podany login nie istnieje w bazie.")
    end
end)

addEvent("logging:newAccount", true)
addEventHandler("logging:newAccount", resourceRoot, function(login,pass)
    local result=exports["ogrpg-db"]:dbGet("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"]:dbSet("INSERT INTO ogrpg_users (login,pass) VALUES (?,?)", login, md5(pass))
        if query then
            triggerClientEvent(client, "logging:result", resourceRoot, false, "Pomy?&#8250;lnie zalogowa?&#8218;e?&#8250;(a?&#8250;) si?&#8482;")
        end
    end
end)


Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-29, 14:00


mixLoLmix2

Programista






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

Piwa: 1915

Respekt: 47,3

AteX, On nie chce na msql tylko na login

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-03-29, 14:19


AteX







Wiek: 27
Na forum: 4157 dni
Posty: 925
Nick w MP: #AteX

Piwa: 8366

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

"mixLoLmix2" napisał/a:

AteX, On nie chce na msql tylko na login


Chce mie? na to i na to... Czytaj ze zrozumieniem.

Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-09, 18:13


CzarnaKobra







Wiek: 30
Na forum: 4324 dni
Posty: 59
Nick w MP: CzarnaKobra

Piwa: 1

Respekt: 45,3

Nie dzia?a :C

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-09, 18:24


Jurandovsky

Kurdebele






Wiek: 17
Na forum: 4980 dni
Posty: 915

Piwa: 2697

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

A masz taki sam login / has?o w tym /register jak i w mysqlu?

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-04-09, 21:46


CzarnaKobra







Wiek: 30
Na forum: 4324 dni
Posty: 59
Nick w MP: CzarnaKobra

Piwa: 1

Respekt: 45,3

chodzi oto ?e jak wklejam ten kod co kolega Atex da? to nic si? nie dzieje wywali skrypt i jak chce sie zalogowa? klikam w okno zaloguj to nic :C

[ Komentarz dodany przez: Emm: 2016-04-09, 21:48 ]
Doda?e? skrypt do ACL Admin?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-10, 11:25


AteX







Wiek: 27
Na forum: 4157 dni
Posty: 925
Nick w MP: #AteX

Piwa: 8366

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

Nast?pnym razem podaj informacj? z db3, bo pisz?c nie dzia?a, zbyt wiele si? nikt nie dowie.

--[[
    Resource: OURGame v2
    Developers: Split <split.programista@gmail.com>
    You have no right to use this code without my permission.
    (c) 2015 <split.programista@gmail.com>. All rights reserved.
]]

addEvent("logging:checkAccount", true)
addEventHandler("logging:checkAccount", resourceRoot, function(login,pass)
    local result=exports["ogrpg-db"]:dbGet("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
            local account = getAccount(login,pass)
            if account then
                logIn(client,account,pass)
            end
            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?&#8230; nieprawid?&#8218;owe.")
        end
    else
        triggerClientEvent(client, "logging:result", resourceRoot, false, "Podany login nie istnieje w bazie.")
    end
end)

addEvent("logging:newAccount", true)
addEventHandler("logging:newAccount", resourceRoot, function(login,pass)
    local result=exports["ogrpg-db"]:dbGet("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"]:dbSet("INSERT INTO ogrpg_users (login,pass) VALUES (?,?)", login, md5(pass))
        if query then
            triggerClientEvent(client, "logging:result", resourceRoot, false, "Pomy?&#8250;lnie zalogowa?&#8218;e?&#8250;(a?&#8250;) si?&#8482;")
        end
    end
end)


Emm do logowania ACL jest niepotrzebny.

Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-10, 13:27


CzarnaKobra







Wiek: 30
Na forum: 4324 dni
Posty: 59
Nick w MP: CzarnaKobra

Piwa: 1

Respekt: 45,3

zn?w nic :C

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-10, 13:35


AteX







Wiek: 27
Na forum: 4157 dni
Posty: 925
Nick w MP: #AteX

Piwa: 8366

Respekt: 775,3
Respekt: 775,3Respekt: 775,3

To podaj db3(/debugscript 3)...

Podpis
MultiTheftAuto++ dla MTA 1.5.7 już dostępne.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-10, 14:02


CzarnaKobra







Wiek: 30
Na forum: 4324 dni
Posty: 59
Nick w MP: CzarnaKobra

Piwa: 1

Respekt: 45,3

Ostatnio zmieniony przez CzarnaKobra 2016-04-10, 14:08, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-10, 14:07


Emm

***** ***






Wiek: 32
Na forum: 4022 dni
Posty: 3191
Nick w MP: Emm

Piwa: 6171

Respekt: 1580
Respekt: 1580Respekt: 1580


   Administrator: Admin ma zawsze rację | REGULAMIN FORUM | REKLAMA/VIP | .
"CzarnaKobra" napisał/a:

Nie ogarniam oco chodzi :c

Wpisz /debugscript 3
I podaj b??dy, je?li wyskakuj? Ci na dole ekranu

Podpis

Użytkownik: 20.10.2015r
GTAO Member: 06.03.2016r
Support-Team: 20.01.2016r
Moderator: 30.03.2016r
Mod-Team: 08.10.2016r
Vice Admin: 04.05.2018r
Administrator: 03.05.2022r


! Koniecznie zapoznaj się z regulaminem forum.
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również regulaminy działów, w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez Administrację, przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w tym dziale.
Najważniejsze informacje od Administracji możesz przeczytać tutaj oraz tutaj.
Postaw piwo autorowi tego posta
 

 
Tagi: panel :: logowania
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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