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

Wysłany: 2014-11-22, 14:19


MKHB







Wiek: 31
Na forum: 4396 dni
Posty: 22
Nick w MP: TheMCMKHB

Piwa: 1

Respekt: 50

Witam co? z?ego z moim panelem logowania co jest nie tak ? dopiero ucz? si? lua ! wi?c co tu nie tak
c-side


GUIEditor = {
    button = {},
    window = {},
    edit = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        GUIEditor.window[1] = guiCreateWindow(0, 221, 1366, 302, "Witamy Na Serwerze RPG (PL)", false)
        guiWindowSetSizable(GUIEditor.window[1], false)

        GUIEditor.edit[1] = guiCreateEdit(799, 44, 238, 46, "", false, GUIEditor.window[1])
        GUIEditor.button[1] = guiCreateButton(1059, 45, 150, 103, "Akceptuje", false, GUIEditor.window[1])
        GUIEditor.button[2] = guiCreateButton(676, 46, 123, 44, "Login", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FF020578")
        GUIEditor.edit[2] = guiCreateEdit(799, 44, 238, 46, "", false, GUIEditor.window[1])
        GUIEditor.edit[3] = guiCreateEdit(799, 92, 238, 46, "", false, GUIEditor.window[1])
        GUIEditor.button[3] = guiCreateButton(678, 92, 121, 46, "Has?o", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FF790000")
        GUIEditor.edit[4] = guiCreateEdit(57, 46, 238, 46, "", false, GUIEditor.window[1])
        GUIEditor.edit[5] = guiCreateEdit(57, 102, 238, 46, "", false, GUIEditor.window[1])
        GUIEditor.edit[6] = guiCreateEdit(57, 158, 238, 46, "", false, GUIEditor.window[1])
        GUIEditor.button[4] = guiCreateButton(302, 46, 128, 46, "Nick/Nazwa", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FF030D53")
        GUIEditor.button[5] = guiCreateButton(302, 102, 128, 46, "Has?o", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FF870000")
        GUIEditor.button[6] = guiCreateButton(302, 158, 128, 46, "Powt?rz Has?o", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[6], "NormalTextColour", "FF870000")
        GUIEditor.button[7] = guiCreateButton(58, 214, 244, 59, "Zarejestruj !", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[7], "NormalTextColour", "FF025502")    

        guiSetVisible ( GUIEditor_Window[1], false )

        local localPlayer = getLocalPlayer ( )

function windowHandler( )
    local playername = getPlayerName(localPlayer)
    
    guiSetText(LoginUsername, "")
    guiSetText(EditRegisterUsername, "")

    guiSetText(LoginUsername, playername)
    guiSetText(EditRegisterUsername, playername)

    guiSetVisible (  GUIEditor_Window[1], true )

    guiSetInputEnabled(true)
    showCursor ( true )
end

function onClickBtn ( button, state )
    if (source == GUIEditor_Button[1]) then
        triggerServerEvent ( "onLogin", getRootElement(), localPlayer, guiGetText(LoginUsername), guiGetText(LoginPassword) )
    end
end

function onClickBtn2 ( button, state )
    if (source == GUIEditor_Button[7]) then
        triggerServerEvent ( "onRegister", getRootElement(), localPlayer, guiGetText(EditRegisterUsername), guiGetText(EditRegisterPassword))
    end
end


function hideLoginWindow()
    guiSetInputEnabled(false)
    guiSetVisible ( GUIEditor_Window[1], false )
    showCursor ( false )
end
addEvent( "hideLoginWindow", true )
addEventHandler( "hideLoginWindow", getRootElement(), hideLoginWindow )

addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), windowHandler )

addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], onClickBtn, false )
addEventHandler ( "onClientGUIClick", GUIEditor_Button[7], onClickBtn2, false )


Ostatnio zmieniony przez MKHB 2014-11-22, 18:31, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-22, 14:29


karolek110199

Programista LUA/PAWN






Wiek: 28
Na forum: 5541 dni
Posty: 54

Piwa: 160

Respekt: 92

Nie widz? zamkni?cia funkcji i eventu onClientResourceStart

Podpis
Pomogłem Ci,
? Daj odetchnąć i postaw piwko ;)
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-22, 14:36


kubak14







Wiek: 24
Na forum: 5346 dni
Posty: 119
Nick w MP: Heavy

Piwa: 149

Respekt: 45,8

Ostrzeżeń: 20%
Nie lepiej

addEventHandler("onPlayerJoin", getResourceRootElement(getThisResource()), windowHandler ) 

zamiast

addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), windowHandler ) 


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-22, 14:46


TheTroll

Pan Majster






Wiek: 39
Na forum: 4905 dni
Posty: 219
Nick w MP: TheTroll

Piwa: 1117

Respekt: 120
Respekt: 120

kubak14, nie lepiej poniewa? 'onPlayerJoin' jest po stronie serwera a wszystkie funkcje zwi?zane z gui s? po stronie klienta i ?eby to dzia?a?o musia? by jeszcze u?ywa? trigger?w :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-22, 15:38


MKHB







Wiek: 31
Na forum: 4396 dni
Posty: 22
Nick w MP: TheMCMKHB

Piwa: 1

Respekt: 50

karolek czy mo?esz mi napisa? co i jak bo to jest cud ?e wg to napisa?em :D dam piffko

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-22, 16:36


karolek110199

Programista LUA/PAWN






Wiek: 28
Na forum: 5541 dni
Posty: 54

Piwa: 160

Respekt: 92

Pierwszy addEventHandler i zawarta w nim funkcja si? nie ko?czy. musisz gdzie? to zamkn?? - doda? przed local localPlayer...
end
);

local localPlayer = ...


Podpis
Pomogłem Ci,
? Daj odetchnąć i postaw piwko ;)
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-22, 16:52


MKHB







Wiek: 31
Na forum: 4396 dni
Posty: 22
Nick w MP: TheMCMKHB

Piwa: 1

Respekt: 50

nie dzia?? :( wg DB3 nic nie pokazuj? ..
podam kod c- side i s-side
c-side

GUIEditor = {
    button = {},
    window = {},
    edit = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        GUIEditor.window[1] = guiCreateWindow(0, 221, 1366, 302, "Witamy Na Serwerze RPG (PL)", false)
        guiWindowSetSizable(GUIEditor.window[1], false)

        GUIEditor.edit[1] = guiCreateEdit(799, 44, 238, 46, "", false, GUIEditor.window[1])
        GUIEditor.button[1] = guiCreateButton(1059, 45, 150, 103, "Akceptuje", false, GUIEditor.window[1])
        GUIEditor.button[2] = guiCreateButton(676, 46, 123, 44, "Login", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FF020578")
        GUIEditor.edit[2] = guiCreateEdit(799, 44, 238, 46, "", false, GUIEditor.window[1])
        GUIEditor.edit[3] = guiCreateEdit(799, 92, 238, 46, "", false, GUIEditor.window[1])
        GUIEditor.button[3] = guiCreateButton(678, 92, 121, 46, "Has?o", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FF790000")
        GUIEditor.edit[4] = guiCreateEdit(57, 46, 238, 46, "", false, GUIEditor.window[1])
        GUIEditor.edit[5] = guiCreateEdit(57, 102, 238, 46, "", false, GUIEditor.window[1])
        GUIEditor.edit[6] = guiCreateEdit(57, 158, 238, 46, "", false, GUIEditor.window[1])
        GUIEditor.button[4] = guiCreateButton(302, 46, 128, 46, "Nick/Nazwa", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FF030D53")
        GUIEditor.button[5] = guiCreateButton(302, 102, 128, 46, "Has?o", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FF870000")
        GUIEditor.button[6] = guiCreateButton(302, 158, 128, 46, "Powt?rz Has?o", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[6], "NormalTextColour", "FF870000")
        GUIEditor.button[7] = guiCreateButton(58, 214, 244, 59, "Zarejestruj !", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[7], "NormalTextColour", "FF025502")    

        guiSetVisible ( GUIEditor_Window[1], false )

        local localPlayer = getLocalPlayer ( )
        end
);

function windowHandler( )
    local playername = getPlayerName(localPlayer)
    
    guiSetText(LoginUsername, "")
    guiSetText(EditRegisterUsername, "")

    guiSetText(LoginUsername, playername)
    guiSetText(EditRegisterUsername, playername)

    guiSetVisible (  GUIEditor_Window[1], true )

    guiSetInputEnabled(true)
    showCursor ( true )
end

function onClickBtn ( button, state )
    if (source == GUIEditor_Button[1]) then
        triggerServerEvent ( "onLogin", getRootElement(), localPlayer, guiGetText(LoginUsername), guiGetText(LoginPassword) )
    end
end

function onClickBtn2 ( button, state )
    if (source == GUIEditor_Button[7]) then
        triggerServerEvent ( "onRegister", getRootElement(), localPlayer, guiGetText(EditRegisterUsername), guiGetText(EditRegisterPassword))
    end
end


function hideLoginWindow()
    guiSetInputEnabled(false)
    guiSetVisible ( GUIEditor_Window[1], false )
    showCursor ( false )
end
addEvent( "hideLoginWindow", true )
addEventHandler( "hideLoginWindow", getRootElement(), hideLoginWindow )

addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), windowHandler )

addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], onClickBtn, false )
addEventHandler ( "onClientGUIClick", GUIEditor_Button[7], onClickBtn2, false )

s-side

function onLogin ( player, user, pass )
    local account = getAccount ( user, pass )
    if ( account ~= false ) then
        if (logIn ( player, account, pass ) == true) then
            triggerClientEvent ( "hideLoginWindow", getRootElement())
        else
            outputChatBox ( "Blad logowania!", player, 255, 255, 0 ) 
        end
    else
        outputChatBox ( "Nie prawidlowe haslo/login!", player, 255, 255, 0 ) -- 
    end
end

addEvent( "onLogin", true )
addEventHandler( "onLogin", getRootElement(), onLogin )

function onRegister ( player, user, pass )
    local account = getAccount ( user, pass )
    if ( account ~= false ) then
        if (logIn ( player, account, pass ) == true) then
            triggerClientEvent ( "hideLoginWindow", getRootElement())
        else
            outputChatBox ( "blad logowania!", player, 255, 255, 0 ) -- Output they got the details wrong.
        end
    else
        account = addAccount ( user, pass )
        if (logIn ( player, account, pass ) == true) then
            triggerClientEvent ( "hideLoginWindow", getRootElement())
        else
            outputChatBox ( "blad logowania/rejestrowania!", player, 255, 255, 0 ) -- Output they got the details wrong.
        end
    end
end

addEvent( "onRegister", true )
addEventHandler( "onRegister", getRootElement(), onRegister )


Ostatnio zmieniony przez MKHB 2014-11-22, 18:29, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-22, 17:57


Dixers

No-Life






Wiek: 26
Na forum: 4453 dni
Posty: 549
Nick w MP: Dixers

Piwa: 412

Respekt: 56,8

MKHB, kod dawaj mi?dzy [lua.] [/lua.] (tylko bez kropek)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-22, 19:03


MKHB







Wiek: 31
Na forum: 4396 dni
Posty: 22
Nick w MP: TheMCMKHB

Piwa: 1

Respekt: 50

Ch?opaki bo sobi? nie radze ! co tu nie tak bo ja nie wiem

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-22, 19:17


karolek110199

Programista LUA/PAWN






Wiek: 28
Na forum: 5541 dni
Posty: 54

Piwa: 160

Respekt: 92

Sprobuj zmieni? handler na dole na addEventHandler("onClientResourceStart", getResourceRootElement(), windowHandler)

Usu? linijk? definiuj?ca localPlayer, bo jest zb?dna. Domy?lnie jest juz zdefiniowane localPlayer.
Poczytaj o debugscript - pomaga bardo, bo pokazuje b??dy itp.

Podpis
Pomogłem Ci,
? Daj odetchnąć i postaw piwko ;)
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-22, 19:30


MKHB







Wiek: 31
Na forum: 4396 dni
Posty: 22
Nick w MP: TheMCMKHB

Piwa: 1

Respekt: 50

wiem co to db ale db3 nic nie wykazuje ;P

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-22, 19:35


Dixers

No-Life






Wiek: 26
Na forum: 4453 dni
Posty: 549
Nick w MP: Dixers

Piwa: 412

Respekt: 56,8

MKHB, zmieni?e? jak m?wi? karolek110199? To mo?e pom?c.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-22, 20:20


karolek110199

Programista LUA/PAWN






Wiek: 28
Na forum: 5541 dni
Posty: 54

Piwa: 160

Respekt: 92

MKHB, w poniedzia?ek b?d? mia? dost?p do kompa i z ch?ci? ci pomoge oraz wytlumacze kilka rzeczy jak b?dziesz chcia?. Napisz na pw to ci poda? skype czy GG.

Podpis
Pomogłem Ci,
? Daj odetchnąć i postaw piwko ;)
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-23, 09:42


MKHB







Wiek: 31
Na forum: 4396 dni
Posty: 22
Nick w MP: TheMCMKHB

Piwa: 1

Respekt: 50

Ok to mi wy?lij ;p , znalaz?em b??d w DB 3 oto ss


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-23, 10:05


Dixers

No-Life






Wiek: 26
Na forum: 4453 dni
Posty: 549
Nick w MP: Dixers

Piwa: 412

Respekt: 56,8

C-side (poprawi?em jeden b??d):

GUIEditor = {
    button = {},
    window = {},
    edit = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        GUIEditor.window[1] = guiCreateWindow(0, 221, 1366, 302, "Witamy Na Serwerze RPG (PL)", false)
        guiWindowSetSizable(GUIEditor.window[1], false)

        GUIEditor.edit[1] = guiCreateEdit(799, 44, 238, 46, "", false, GUIEditor.window[1])
        GUIEditor.button[1] = guiCreateButton(1059, 45, 150, 103, "Akceptuje", false, GUIEditor.window[1])
        GUIEditor.button[2] = guiCreateButton(676, 46, 123, 44, "Login", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FF020578")
        GUIEditor.edit[2] = guiCreateEdit(799, 44, 238, 46, "", false, GUIEditor.window[1])
        GUIEditor.edit[3] = guiCreateEdit(799, 92, 238, 46, "", false, GUIEditor.window[1])
        GUIEditor.button[3] = guiCreateButton(678, 92, 121, 46, "Has?o", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FF790000")
        GUIEditor.edit[4] = guiCreateEdit(57, 46, 238, 46, "", false, GUIEditor.window[1])
        GUIEditor.edit[5] = guiCreateEdit(57, 102, 238, 46, "", false, GUIEditor.window[1])
        GUIEditor.edit[6] = guiCreateEdit(57, 158, 238, 46, "", false, GUIEditor.window[1])
        GUIEditor.button[4] = guiCreateButton(302, 46, 128, 46, "Nick/Nazwa", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FF030D53")
        GUIEditor.button[5] = guiCreateButton(302, 102, 128, 46, "Has?o", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FF870000")
        GUIEditor.button[6] = guiCreateButton(302, 158, 128, 46, "Powt?rz Has?o", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[6], "NormalTextColour", "FF870000")
        GUIEditor.button[7] = guiCreateButton(58, 214, 244, 59, "Zarejestruj !", false, GUIEditor.window[1])
        guiSetProperty(GUIEditor.button[7], "NormalTextColour", "FF025502")    

        guiSetVisible ( GUIEditor.window[1], false )

        local localPlayer = getLocalPlayer ( )
        end
);

function windowHandler( )
    local playername = getPlayerName(localPlayer)
    
    guiSetText(LoginUsername, "")
    guiSetText(EditRegisterUsername, "")

    guiSetText(LoginUsername, playername)
    guiSetText(EditRegisterUsername, playername)

    guiSetVisible (  GUIEditor_Window[1], true )

    guiSetInputEnabled(true)
    showCursor ( true )
end

function onClickBtn ( button, state )
    if (source == GUIEditor_Button[1]) then
        triggerServerEvent ( "onLogin", getRootElement(), localPlayer, guiGetText(LoginUsername), guiGetText(LoginPassword) )
    end
end

function onClickBtn2 ( button, state )
    if (source == GUIEditor_Button[7]) then
        triggerServerEvent ( "onRegister", getRootElement(), localPlayer, guiGetText(EditRegisterUsername), guiGetText(EditRegisterPassword))
    end
end


function hideLoginWindow()
    guiSetInputEnabled(false)
    guiSetVisible ( GUIEditor_Window[1], false )
    showCursor ( false )
end
addEvent( "hideLoginWindow", true )
addEventHandler( "hideLoginWindow", getRootElement(), hideLoginWindow )

addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), windowHandler )

addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], onClickBtn, false )
addEventHandler ( "onClientGUIClick", GUIEditor_Button[7], onClickBtn2, false )


Postaw piwo autorowi tego posta
 

 
Tagi: panel :: logowania :: coś :: nie :: tak
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 logowania coś nie tak 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