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

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


LordKamis







Wiek: 26
Na forum: 4340 dni
Posty: 107

Piwa: 190

Respekt: 60

Witam ci?gle wyskakuje mi "B??d! Spr?buj ponownie!"
Za pomoc stawiam piwko :piwo:
Ps: doda?em wpis do ACL




function registerPlayer(username,password,passwordConfirm)
    if not (username == ""then
        if not (password == ""then
            if not (passwordConfirm == ""then
                if password == passwordConfirm then
                    local account getAccount (username,password)
                    if (account == falsethen
                        local accountAdded addAccount(tostring(username),tostring(password))
                        if (accountAddedthen
                            outputChatBox ("#00FF00Uda?o Ci si? zarejestrowa?! [Username: #FFFFFF" .. username .. " #00FF00| Password: #FFFFFF" .. password .. "#00FF00 ]",source,255,255,255,true )
                        else
                            triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","B??d! Spr?buj ponownie!")
                        end
                    else
                        triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Ta nazwa u?ytkownika ju? istnieje!")
                    end
                else
                    triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Has?a nie s? identyczne!")
                end
            else
                triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Prosz? potwierdzi? has?o!")
            end
        else
            triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Prosz? poda? swoje has?o!")
        end
    else
        triggerClientEvent(source,"set_warning_text",getRootElement(),"Register","Wprowad? swoj? nazw? u?ytkownika!")
    end
end
addEvent("onRequestRegister",true)
addEventHandler("onRequestRegister",getRootElement(),registerPlayer)



Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-18, 00:56


Blur







Wiek: 28
Na forum: 4298 dni
Posty: 47
Nick w MP: Blu

Piwa: 2

Respekt: 50

Z tego co my?l? to pierwszy else odpowiada sprawdzaniu czy konto zosta?o stworzone, tak?e zobacz co w debugu wyskakuje i wrzu? tutaj.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-18, 08:31


Vike4562

LUA <3






Wiek: 28
Na forum: 4937 dni
Posty: 144
Nick w MP: Vike4562

Piwa: 32

Respekt: 61

Co do tworzenia konta to nie mo?e by? tak:
local accountAdded addAccount(tostring(username),tostring(password))


nwm dlaczego, ale musi by? tak:
local accountAdded addAccount(tostring(getAccount (username,password)),tostring(password))

lub
local accountAdded addAccount(tostring(account),tostring(password))

w tym account odnosisz si? do wy?szej linijki getAccount

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-18, 15:41


LordKamis







Wiek: 26
Na forum: 4340 dni
Posty: 107

Piwa: 190

Respekt: 60

Poprawki w kodzie nic nie zmieni?y.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-18, 17:56


piotr172







Wiek: 26
Na forum: 4417 dni
Posty: 130

Piwa: 2329

Respekt: 105,3
Respekt: 105,3

Znam ten skrypt. Wstawi?e? t? linijk? do ACL w grupie Admin? Powinno wygl?da? to tak:

Kod:

<group name="Admin">
<acl name="Moderator"></acl>
<acl name="SuperModerator"></acl>
<acl name="Admin"></acl>
<acl name="RPC"></acl>
<object name="resource.admin"></object>
<object name="resource.webadmin"></object>
<object name="resource.nazwaskryptu"></object>
</group>


Te? mia?em ten kod. Dzia?a? mi dobrze po tym jak wstawi?em odpowiednio link?. Sprawd? na pewno czy masz dobrze ta linijk?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-18, 17:58


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

LordKamis, podaj zamiast:
if (accountAddedthen

daj to:
if (logIn(playeraccountpassword) == truethen
sprawdz.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-18, 22:01


markob0







Wiek: 27
Na forum: 4248 dni
Posty: 151
Nick w MP: Markob

Piwa: 939

Respekt: 98,2

piotr172, musimy czyta? ze zrozumieniem. Zobacz co napisa? LordKamis,
Cytat:

Ps: doda?em wpis do ACL


Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-18, 22:34


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4395 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Vike4562, co to za r??nica czy pobierzesz konto w linijce czy za pomoc? zmiennej?

Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-18, 23:14


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

LordKamis, sprawd? czy dzia?a to co poda?em.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-18, 23:33


Vike4562

LUA <3






Wiek: 28
Na forum: 4937 dni
Posty: 144
Nick w MP: Vike4562

Piwa: 32

Respekt: 61

Shuffle, pomyli?o mi si?, bo wiedzia?em ?e w addAccount albo w logIn mia?o to by?

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-19, 08:24


LordKamis







Wiek: 26
Na forum: 4340 dni
Posty: 107

Piwa: 190

Respekt: 60

Poprawki nic nie wnios?y ten sam b??d.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-19, 08:42


Vike4562

LUA <3






Wiek: 28
Na forum: 4937 dni
Posty: 144
Nick w MP: Vike4562

Piwa: 32

Respekt: 61

skoro wyskakuje b??d z if (addAccount) then to problem musi by? tu:

usun??em tostring(..)
local accountAdded addAccount(usernamepassword)


Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-19, 08:51


LordKamis







Wiek: 26
Na forum: 4340 dni
Posty: 107

Piwa: 190

Respekt: 60

Niestety nie dzia?a hmmm nie mog? zrozumie? co zrobi?em ?le.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-19, 11:54


Vike4562

LUA <3






Wiek: 28
Na forum: 4937 dni
Posty: 144
Nick w MP: Vike4562

Piwa: 32

Respekt: 61

A jak wygl?da strona c-side? Bo wygl?da na to ?e po stronie s-side jest wszystko ok ( chyba xD )

[ Dodano: 2014-11-19, 12:41 ]
Funkcje sprawdzi?em u siebie na serwerze i wszystko dzia?a, wina musi by? po stronie c-side

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-11-19, 18:02


LordKamis







Wiek: 26
Na forum: 4340 dni
Posty: 107

Piwa: 190

Respekt: 60

wdwLogin_Pannel = {}
tabPannel_Main = {}
tab_Login = {}
tab_Register = {}

function open_log_reg_pannel()

if not(isElement(wdwLogin_Pannel)) then
     
    showChat(false)
    
    x,guiGetScreenSize()
    
    local sWidth,sHeight guiGetScreenSize() 
    local Width,Height 350,350
    local X = (sWidth/2) - (Width/2)
    local Y = (sHeight/2) - (Height/2)
    
    
    Image guiCreateStaticImage0019201200"login_bg.png"false )
    guiSetEnabled (Imagefalse)
    
    Login_img guiCreateStaticImage2541350350"login_window.png"false )
    guiSetEnabled (Login_imgfalse)
    
    --!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    shLogin guiCreateStaticImage550909040"login.png"false )
    addEventHandler("onClientGUIClick",shLogin,onClickBtnLogin)
    addEventHandler"onClientMouseEnter",shLogin,LoginSH)
    addEventHandler("onClientMouseLeave",shLogin,SErem)
    
    edit_Login guiCreateEdit(400,100,150,25,"",false)
    edit_password guiCreateEdit(400,150,150,25,"",false)
    guiEditSetMaxLength edit_Login,25)
    guiEditSetMaxLength edit_password,25)
    guiEditSetMasked edit_passwordtrue )
    
    lbl_about_legth guiCreateLabel(142,42,184,18,"",false)
    guiLabelSetColor(lbl_about_legth,253,255,68)
    guiLabelSetVerticalAlign(lbl_about_legth,"center")
    guiLabelSetHorizontalAlign(lbl_about_legth,"center",false)
    
    checkbox_save guiCreateCheckBox(400,180,20,20,"Zapami?taj",false,false)
    guiSetFont(checkbox_save,"default-small")
    
    
    login_tab_error_msg guiCreateLabel(295,200,364,31,"Error_login_tab",false)
    guiLabelSetColor(login_tab_error_msg,255,0,0)
    guiLabelSetVerticalAlign(login_tab_error_msg,"center")
    guiLabelSetHorizontalAlign(login_tab_error_msg,"center",false)
    guiSetFont(login_tab_error_msg,"default-bold-small")

        
    --!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!    
    
    lbl_reg_top_info guiCreateLabel(235,250,500,30,"Zabrania si? u?ywania: (\"!@#$\"%'^&*()\")",false)
    guiLabelSetColor(lbl_reg_top_info,0,0,0)
    guiLabelSetVerticalAlign(lbl_reg_top_info,"center")
    guiLabelSetHorizontalAlign(lbl_reg_top_info,"center",false)
    guiSetVisible(lbl_reg_top_info,false)
    
    edit_account_name guiCreateEdit(400,100,150,25,"",false)
    guiEditSetMaxLength edit_account_name,25)
    guiSetVisible(edit_account_name,false)
    
    edit__reg_tab_password guiCreateEdit(400,140,150,25,"",false)
    guiEditSetMaxLength edit__reg_tab_password,25)
    guiEditSetMasked edit__reg_tab_passwordtrue )
    guiSetVisible(edit__reg_tab_password,false)
    
    
    edit__reg_tab_Repassword guiCreateEdit(400,180,150,25,"",false)
    guiEditSetMaxLength edit__reg_tab_Repassword,25)
    guiEditSetMasked edit__reg_tab_Repasswordtrue )
    guiSetVisible(edit__reg_tab_Repassword,false)
    guiSetEnabled (edit__reg_tab_Repasswordtrue)    
    
    --!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    shRegister guiCreateStaticImage55014515040"register.png"false )
    addEventHandler("onClientGUIClick",shRegister,OnBtnRegister)
    addEventHandler"onClientMouseEnter",shRegister,RegisterSH)
    addEventHandler("onClientMouseLeave",shRegister,SErem)
    
    --!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    shRegister2 guiCreateStaticImage33520030070"register2.png"false )
    addEventHandler("onClientGUIClick",shRegister2,onClickBtnRegister)
    addEventHandler"onClientMouseEnter",shRegister2,Register2SH)
    addEventHandler("onClientMouseLeave",shRegister2,SErem)
    
    guiSetVisible(shRegister2,false)
    
    reg_tab_error_msg guiCreateLabel(295,200,364,31,"Error_reg_ttab",false)
    guiLabelSetColor(reg_tab_error_msg,255,20,0)
    guiLabelSetVerticalAlign(reg_tab_error_msg,"center")
    guiLabelSetHorizontalAlign(reg_tab_error_msg,"center",false)
    guiSetFont(reg_tab_error_msg,"default-bold-small")
    

    showCursor(true)

    guiSetText(reg_tab_error_msg"")
    guiSetText(login_tab_error_msg"")
    
    
    local usernamepassword loadLoginFromXML()
    
    if notusername == "" or password == ""then
        guiCheckBoxSetSelected checkbox_savetrue )
        guiSetText edit_Logintostring(username))
        guiSetText edit_passwordtostring(password))
    else
        guiCheckBoxSetSelected checkbox_savefalse )
        guiSetText edit_Logintostring(username))
        guiSetText edit_passwordtostring(password))
    end
    end
    
end

function LoginSH ()
    guiStaticImageLoadImage(shLogin"sh.png" )
end

function RegisterSH ()
    guiStaticImageLoadImage(shRegister"shr.png" )
end

function Register2SH ()
    guiStaticImageLoadImage(shRegister2"shr2.png" )
end

function GuestSH ()
    guiStaticImageLoadImage(shGuest"shg.png" )
end

function SErem ()
guiStaticImageLoadImage(shLogin"login.png" )
guiStaticImageLoadImage(shRegister"register.png" )
guiStaticImageLoadImage(shGuest"guest.png" )
guiStaticImageLoadImage(shRegister2"register2.png" )
end

function start_cl_resource()
    open_log_reg_pannel()
end
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),start_cl_resource)


function loadLoginFromXML()
    local xml_save_log_File xmlLoadFile ("files/xml/userdata.xml")
    if not xml_save_log_File then
        xml_save_log_File xmlCreateFile("files/xml/userdata.xml""login")
    end
    local usernameNode xmlFindChild (xml_save_log_File"username"0)
    local passwordNode xmlFindChild (xml_save_log_File"password"0)
    if usernameNode and passwordNode then
        return xmlNodeGetValue(usernameNode), xmlNodeGetValue(passwordNode)
    else
        return """"
    end
    xmlUnloadFile xml_save_log_File )
end
 
 
function saveLoginToXML(usernamepassword)
    local xml_save_log_File xmlLoadFile ("files/xml/userdata.xml")
    if not xml_save_log_File then
        xml_save_log_File xmlCreateFile("files/xml/userdata.xml""login")
    end
    if (username ~= ""then
        local usernameNode xmlFindChild (xml_save_log_File"username"0)
        if not usernameNode then
            usernameNode xmlCreateChild(xml_save_log_File"username")
        end
        xmlNodeSetValue (usernameNodetostring(username))
    end
    if (password ~= ""then
        local passwordNode xmlFindChild (xml_save_log_File"password"0)
        if not passwordNode then
            passwordNode xmlCreateChild(xml_save_log_File"password")
        end        
        xmlNodeSetValue (passwordNodetostring(password))
    end
    xmlSaveFile(xml_save_log_File)
    xmlUnloadFile (xml_save_log_File)
end
addEvent("saveLoginToXML"true)
addEventHandler("saveLoginToXML"getRootElement(), saveLoginToXML)



function resetSaveXML()
        local xml_save_log_File xmlLoadFile ("files/xml/userdata.xml")
        if not xml_save_log_File then
            xml_save_log_File xmlCreateFile("files/xml/userdata.xml""login")
        end
        if (username ~= ""then
            local usernameNode xmlFindChild (xml_save_log_File"username"0)
            if not usernameNode then
                usernameNode xmlCreateChild(xml_save_log_File"username")
            end
        end
        if (password ~= ""then
            local passwordNode xmlFindChild (xml_save_log_File"password"0)
            if not passwordNode then
                passwordNode xmlCreateChild(xml_save_log_File"password")
            end        
            xmlNodeSetValue (passwordNode"")
        end
        xmlSaveFile(xml_save_log_File)
        xmlUnloadFile (xml_save_log_File)
end
addEvent("resetSaveXML"true)
addEventHandler("resetSaveXML"getRootElement(), resetSaveXML)

function onClickBtnLogin(button,state)
    
    showChat(true)
    showCursor(false)
    guiSetVisible(Image,false)
        guiSetVisible(shGuestfalse)
        guiSetVisible(Imagefalse)
        guiSetVisible(shLoginfalse)
        guiSetVisible(shRegisterfalse)
        guiSetVisible(edit_passwordfalse)
        guiSetVisible(edit_Loginfalse)
        guiSetVisible(checkbox_savefalse)
        guiSetVisible(Login_imgfalse)
    
    
    if(button == "left" and state == "up"then
        if (source == shLoginthen
            username guiGetText(edit_Login)
            password guiGetText(edit_password)
                if guiCheckBoxGetSelected checkbox_save ) == true then
                    checksave true
                else
                    checksave false
                end
            triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,checksave)
        end
    end
end

function OnBtnRegister ()
    guiStaticImageLoadImage(Login_img"register_window.png" )
    guiSetVisible(shRegister2true)
    guiSetVisible(lbl_reg_top_info,true)
    guiSetVisible(edit__reg_tab_Repassword,true)
    guiSetEnabled (edit__reg_tab_Repasswordtrue)
    guiSetVisible(edit__reg_tab_password,true)
    guiSetVisible(edit_account_name,true)
       guiSetVisible(shGuestfalse)
        guiSetVisible(shLoginfalse)
        guiSetVisible(shRegisterfalse)
        guiSetVisible(edit_passwordfalse)
        guiSetVisible(edit_Loginfalse)
        guiSetVisible(checkbox_savefalse)
end

function onClickBtnRegister(button,state)
    
    
    guiStaticImageLoadImage(Login_img"Login_window.png" )
     
        guiSetVisible(shGuesttrue)
        guiSetVisible(shLogintrue)
        guiSetVisible(shRegistertrue)
        guiSetVisible(edit_passwordtrue)
        guiSetVisible(edit_Logintrue)
        guiSetVisible(checkbox_savetrue)
        guiSetVisible(shRegister2false)
        guiSetVisible(edit__reg_tab_passwordfalse)
        guiSetVisible(edit__reg_tab_Repasswordfalse)
        guiSetVisible(edit_account_namefalse)
        guiSetVisible(lbl_reg_top_infofalse)
        showCursor(true)
    
    --
            username guiGetText(edit_account_name)
            password guiGetText(edit__reg_tab_password)
            passwordConfirm guiGetText(edit__reg_tab_Repassword)
            triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,passwordConfirm)
            
            guiSetText(reg_tab_error_msg"Zarejestrowa?e? si?!")
            guiLabelSetColor reg_tab_error_msg0255)
            setTimer(function() guiSetText(reg_tab_error_msg""end,3000,1)
            setTimer(function() guiLabelSetColor reg_tab_error_msg2550end,3000,1)
            
end



function Error_msg(TabText)
showCursor(true)
    if Tab == "Login" then 
    
        guiSetVisible(btnGuesttrue)
        guiSetVisible(shGuesttrue)
        guiSetVisible(Imagetrue)
        guiSetVisible(shLogintrue)
        guiSetVisible(shRegistertrue)
        guiSetVisible(btn_reg_tab_registertrue)
        guiSetVisible(edit_passwordtrue)
        guiSetVisible(edit_Logintrue)
        guiSetVisible(checkbox_savetrue)
        guiSetVisible(Login_imgtrue)

    
        guiSetText(login_tab_error_msgtostring(Text))
        setTimer(function() guiSetText(login_tab_error_msg""end,3000,1)
    elseif Tab == "Register" then
        guiSetText(reg_tab_error_msgtostring(Text))
        setTimer(function() guiSetText(reg_tab_error_msg""end,3000,1)
    end
end
addEvent("set_warning_text",true)
addEventHandler("set_warning_text",getRootElement(),Error_msg)


function onClickGuest()
    
    showChat(true)
    
    guiSetVisible(Image,false)
        guiSetVisible(shGuestfalse)
        guiSetVisible(Imagefalse)
        guiSetVisible(shLoginfalse)
        guiSetVisible(shRegisterfalse)
        guiSetVisible(edit_passwordfalse)
        guiSetVisible(edit_Loginfalse)
        guiSetVisible(checkbox_savefalse)
        guiSetVisible(Login_imgfalse)
            showCursor(false)
end


function hideLoginWindow()
    
    outputChatBox("Pomy?lnie zalogowano!")
    showCursor(false)
    showChat(true)
    removeEventHandler("onClientGUIClick",shLogin,onClickBtnLogin)
end
addEvent("hideLoginWindow"true)
addEventHandler("hideLoginWindow"getRootElement(), hideLoginWindow)




[ Dodano: 2014-11-20, 20:22 ]
Dla u?atwienia ss z debugscript

ss

[ Dodano: 2014-11-23, 05:21 ]
Vike4562, B??d jest po stronie servera.

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