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

Wysłany: 2016-05-23, 20:31


Jakub123313

LUA / Mapper <3






Wiek: 31
Na forum: 4228 dni
Posty: 62
Nick w MP: DjBoreK

Piwa: 8

Respekt: 50

Od czasu kolega robi serwer Effect - Life i jako? nie dzia?a mu panel logowania

kod servera :

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)

Kod Clienta :


    Resource: OUGame 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.
]]

x,y=36.63,82.19 -- my width
intro_step=math.random(0,850)

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
local dist = 100
local angler = 0
function getPointFromDistanceRotation(x, y, dist, angler)
    local a = math.rad(90 - angler)
    local dx = math.cos(a) * dist;
    local dy = math.sin(a) * dist;
    return x+dx, y+dy;
end

function renderLoginBox()
    --dxDrawImage(0, 0, 1920, 1080, "misc/drift.png", AristatesYuvarlak, 0, 0, tocolor(255, 255, 255, 255), false)
    dxDrawRectangle(sx*270/1025, sy*150/769, sx*500/1025, sy*458/767, tocolor(0, 0, 0, 135), false)
    --dxDrawImage(0, 0, 1920, 1080, "misc/drift.png", AristatesYuvarlak, 0, 0, tocolor(255, 255, 255, 255), false)
    if data.info then dxDrawText(data.info, sx*252/1024, sy*272/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(251, 69, 0, 255), 5, false)
    --dxDrawLine(sx*0/1024, sy*509/768, sx*1022/1024, sy*510/768, tocolor(251, 69, 0, 255), 5, false)
    dxDrawText("U?ytkownik:", sx*280/1024, sy*270/768, sx*760/1024, sy*302/768, white, 1.10, "pricedown", "center", "center", false)
    dxDrawText("Has?o:", sx*-240/1024, sy*480/768, sx*1280/1024, sy*302/768, white, 1.10, "pricedown", "center", "center", false)
    if not isMouseIn(sx*305/1024, sy*506/768, sx*200/1024, sy*45/768) then dxDrawRectangle(sx*305/1024, sy*506/768, sx*200/1024, sy*45/768, tocolor(0, 200, 20, 165), false)
    else dxDrawRectangle(sx*305/1024, sy*506/768, sx*200/1024, sy*45/768, tocolor(50, 50, 50, 165), false) end
    if not isMouseIn(sx*535/1024, sy*506/768, sx*200/1024, sy*45/768) then dxDrawRectangle(sx*535/1024, sy*506/768, sx*200/1024, sy*45/768, tocolor(0, 200, 20, 165), false)
    else dxDrawRectangle(sx*535/1024, sy*506/768, sx*200/1024, sy*45/768, tocolor(50, 50, 50, 165), false) end
    dxDrawText("Zaloguj", sx*685/1024, sy*1015/768, sx*130/1024, sy*45/768, white, 1.00, "default-bold", "center", "center", false)
    dxDrawText("Zarejestruj", sx*1140/1024, sy*1013/768, sx*130/1024, sy*45/768, white, 1.00, "default-bold", "center", "center", false)
    dxDrawImage(sx * 0.3118, sy * 0.1813, sx * 0.3838, sy * 0.1549, "logo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    --dxDrawImage(sw/2-295,sh/2+70,594,307,"logo.png", angle, 0, -120 )
    
    --local x,y=getPointFromDistanceRotation(-1753.77,885.21, dist, angler)
    --setCameraMatrix(x,y,242.08+5,-1753.77,885.21,242.08)
    --angler=(angler+0.3)

    local zone1=math.sin(intro_step/500)*9000
    local zone2=math.cos(intro_step/500)*9000
    setCameraMatrix (-2062.8857421875, 249.9111328125, 50.4609375, zone1, zone2, 2)
    --setCameraMatrix(zone1, zone2, 120, zone1, zone2, 120)
    intro_step=intro_step-1.5
end



addEventHandler("onClientClick", root, function(btn,state)
    if btn=="left" and state=="down" then
        if isMouseIn(sx*305/1024, sy*506/768, sx*200/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*535/1024, sy*506/768, sx*200/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)
    setElementData ( localPlayer, "shader", true )
    fadeCamera(true)
    data.showed=true
    setElementAlpha(localPlayer,0)
    data.misc=playSound("misc/intro.mp3",true)
    setSoundVolume(data.misc, 1.0)
    showPlayerHudComponent("all",false)
    showPlayerHudComponent("money",false)
    showPlayerHudComponent("clock",false)
    guiSetInputMode("no_binds_when_editing")
    setElementData(localPlayer,"status","Loguje si?")
    setElementData(localPlayer,"player:logged",false)
    addEventHandler("onClientRender", root, renderLoginBox)
    data.button[1]=guiCreateEdit(0.40, 0.40, 0.22, 0.04, "", true)
    data.button[2]=guiCreateEdit(0.40, 0.53, 0.22, 0.04, "", true)   
    guiEditSetMasked(data.button[2],true)
end)


Prosz? stosowa? znaczniki lua/code //Emm

Ostatnio zmieniony przez Emm 2016-05-23, 20:41, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-05-24, 19:42


_Wicek_

Majstersztyk






Wiek: 26
Na forum: 4402 dni
Posty: 747
Nick w MP: Wicek

Piwa: 1842

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

Ostrzeżeń: 40%
Jakub123313, Ale co Ci tu nie dzia?a ?

Podpis

Support-Team: 25.01.2016
Moderator: 10.07.2016




GG: 51274621
Skype : kuba_wicinski
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-05-24, 21:03


limitowanyy







Wiek: 44
Na forum: 4697 dni
Posty: 41

Piwa: 281

Respekt: 20,5

Ostrzeżeń: 20%
Zapewne na plik ogrpg-db a nie og-db, dlatego og_users nie transferuje i nie da sie zalogowac. :)

Postaw piwo autorowi tego posta
 

 
Tagi: efect :: life :: 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 » Efect Life - 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