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

Wysłany: 2013-06-25, 12:22


Drak







Wiek: 34
Na forum: 4903 dni
Posty: 71
Nick w MP: Drak

Piwa: 3

Respekt: 50

Mam problem z login panelem.


Oto kod:
GUIEditor = {
    tab = {},
    tabpanel = {},
    edit = {},
    button = {},
    window = {},
    label = {}
}
function loginWindow()

    GUIEditor.window[1] = guiCreateWindow(453323356321"Login panel"false)
    guiWindowSetMovable(GUIEditor.window[1], false)
    guiWindowSetSizable(GUIEditor.window[1], false)
    guiSetAlpha(GUIEditor.window[1], 1.00)
    
    GUIEditor.tabpanel[1] = guiCreateTabPanel(923337288falseGUIEditor.window[1])

    GUIEditor.tab[1] = guiCreateTab("Logowanie"GUIEditor.tabpanel[1])

    GUIEditor.label[1] = guiCreateLabel(366211130"Login:"falseGUIEditor.tab[1])
    guiSetFont(GUIEditor.label[1], "clear-normal")
    guiLabelSetColor(GUIEditor.label[1], 0170255)
    guiLabelSetHorizontalAlign(GUIEditor.label[1], "center"false)
    guiLabelSetVerticalAlign(GUIEditor.label[1], "center")
    GUIEditor.edit[1] = guiCreateEdit(1476213829""falseGUIEditor.tab[1])
    GUIEditor.edit[2] = guiCreateEdit(1476213829""falseGUIEditor.tab[1])
    GUIEditor.edit[3] = guiCreateEdit(1476213829""falseGUIEditor.tab[1])
    GUIEditor.label[2] = guiCreateLabel(366211130"Login:"falseGUIEditor.tab[1])
    guiSetFont(GUIEditor.label[2], "clear-normal")
    guiLabelSetColor(GUIEditor.label[2], 0170255)
    guiLabelSetHorizontalAlign(GUIEditor.label[2], "center"false)
    guiLabelSetVerticalAlign(GUIEditor.label[2], "center")
    GUIEditor.label[3] = guiCreateLabel(366211130"Login:"falseGUIEditor.tab[1])
    guiSetFont(GUIEditor.label[3], "clear-normal")
    guiLabelSetColor(GUIEditor.label[3], 0170255)
    guiLabelSetHorizontalAlign(GUIEditor.label[3], "center"false)
    guiLabelSetVerticalAlign(GUIEditor.label[3], "center")
    GUIEditor.label[4] = guiCreateLabel(379211031"Has?o:"falseGUIEditor.tab[1])
    guiSetFont(GUIEditor.label[4], "clear-normal")
    guiLabelSetColor(GUIEditor.label[4], 0170255)
    guiLabelSetHorizontalAlign(GUIEditor.label[4], "center"false)
    guiLabelSetVerticalAlign(GUIEditor.label[4], "center")
    GUIEditor.edit[4] = guiCreateEdit(1479213833""falseGUIEditor.tab[1])
    GUIEditor.button[1] = guiCreateButton(10617614052"Zaloguj"falseGUIEditor.tab[1])
    guiSetFont(GUIEditor.button[1], "sa-header")
    guiSetProperty(GUIEditor.button[1], "NormalTextColour""FF00AAFF")

    GUIEditor.tab[2] = guiCreateTab("Rejestracja"GUIEditor.tabpanel[1])

    GUIEditor.label[5] = guiCreateLabel(67558727"Login:"falseGUIEditor.tab[2])
    guiSetFont(GUIEditor.label[5], "clear-normal")
    guiLabelSetColor(GUIEditor.label[5], 0170255)
    guiLabelSetHorizontalAlign(GUIEditor.label[5], "center"false)
    guiLabelSetVerticalAlign(GUIEditor.label[5], "center")
    GUIEditor.label[6] = guiCreateLabel(68838628"Has?o:"falseGUIEditor.tab[2])
    guiSetFont(GUIEditor.label[6], "clear-normal")
    guiLabelSetColor(GUIEditor.label[6], 0170255)
    guiLabelSetHorizontalAlign(GUIEditor.label[6], "center"false)
    guiLabelSetVerticalAlign(GUIEditor.label[6], "center")
    GUIEditor.label[7] = guiCreateLabel(691108530"Powt?rz Has?o:"falseGUIEditor.tab[2])
    guiLabelSetColor(GUIEditor.label[7], 0170255)
    guiLabelSetHorizontalAlign(GUIEditor.label[7], "center"false)
    guiLabelSetVerticalAlign(GUIEditor.label[7], "center")
    GUIEditor.edit[5] = guiCreateEdit(1555513127""falseGUIEditor.tab[2])
    GUIEditor.edit[6] = guiCreateEdit(1568113029""falseGUIEditor.tab[2])
    GUIEditor.edit[7] = guiCreateEdit(15511013130""falseGUIEditor.tab[2])
    GUIEditor.button[2] = guiCreateButton(8915017760"Zarejestruj"falseGUIEditor.tab[2])
    guiSetFont(GUIEditor.button[2], "sa-header")
    guiSetProperty(GUIEditor.button[2], "NormalTextColour""FF00AAFF")
    
    addEventHandler("onClientGUIClick"GUIEditor.button[1], onClickBtnLogin)
    addEventHandler("onClientGUIClick"GUIEditor.button[2], onClickBtnRegister)
end

function startLoginWindow()
    loginWindow()
end
addEventHandler("onClientResourceStart"getResourceRootElement(getThisResource()), startLoginWindow)

function loadLogins()
    local save_file xmlLoadFile("konta/konta.xml")
    if not save_file then
        save_file xmlCreateFile("konta/konta.xml""login")
    end
    local login xmlFindChild (save_file"username"0)
    local haslo xmlFindChild (save_file"password"0)
    if login and haslo then
        return xmlNodeGetValue(login), xmlNodeGetValue(haslo)
    else
        return """"
    end
    xmlUnloadFile(save_file)
end

function saveLogins()
    local save_file xmlLoadFile("konta/konta.xml")
    if not save_file then
        save_file xmlCreateFile("konta/konta.xml""login")
    end
    if (username ~= "")then
        local login xmlFindChild (save_file"username"0)
        if not login then
            login xmlCreateChild(save_file"username")
        end
        xmlNodeSetValue (logintostring(username))
    end
    if(password ~= "")then
        local haslo xmlFindChild (save_file"password"0)
        if not haslo then
            haslo xmlCreateChild(save_file"password")
        end        
        xmlNodeSetValue (haslotostring(password))
    end
    xmlSaveFile(save_file)
    xmlUnloadFile (save_file)
end
addEvent("saveLogins"true)
addEventHandler("saveLoginsL"getRootElement(), saveLogins)

function resetSaveXML() 
        local save_file xmlLoadFile("konta/konta.xml")
        if not save_file then
            save_file xmlCreateFile("konta/konta.xml""login")
        end
        if (username ~= ""then
            local login xmlFindChild (save_file"username"0)
            if not login then
                login xmlCreateChild(save_file"username")
            end
        end
        if (haslo ~= ""then
            local haslo xmlFindChild (save_file"password"0)
            if not haslo then
                haslo xmlCreateChild(save_file"password")
            end        
            xmlNodeSetValue (haslo"")
        end
        xmlSaveFile(save_file)
        xmlUnloadFile (save_file)
end
addEvent("resetSaveXML"true)
addEventHandler("resetSaveXML"getRootElement(), resetSaveXML)

function onClickBtnLogin(button,state) 
    if(button == "left" and state == "up"then
        if (source == GUIEditor.button[1]) then
            username guiGetText(GUIEditor.label[3])
            password guiGetText(GUIEditor.label[4])
            triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password)
        end
    end
end

function onClickBtnRegister(button,state) 
    if(button == "left" and state == "up"then
        if (source == GUIEditor.button[2]) then
            username guiGetText(GUIEditor.label[5])
            password guiGetText(GUIEditor.label[6])
            passwordConfirm guiGetText(GUIEditor.label[7])
            triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,passwordConfirm)
        end
    end
end

function hideLoginWindow()
    guiSetInputEnabled(false)
    guiSetVisible(GUIEditor.window[1], false)
    destroyElement(GUIEditor.window[1])
    GUIEditor.window[1] = nil
    showCursor(false)
    removeEventHandler("onClientGUIClick"GUIEditor.button[1], onClickBtnLogin)
end
addEvent("hideLoginWindow"true)
addEventHandler("hideLoginWindow"getRootElement(), hideLoginWindow)


Zero b??d?w w konsoli, a panel si? nie pojawia.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-07-01, 08:36


krisu477







Wiek: 25
Na forum: 4837 dni
Posty: 54
Nick w MP: Krisek

Piwa: 7

Respekt: 70

addEventHandler("onClientResourceStart"getResourceRootElement(getThisResource()), startLoginWindow)
My?l?, ?e to trzeba zmieni? na:
addEventHandler("onClientPlayerJoin"getLocalPlayer(), startLoginWindow)
i reszt? przystosowa? do tego.

Postaw piwo autorowi tego posta
 

 
Tagi: login :: panel
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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