Jump to content

Login Panel


Mark0

Recommended Posts

i create a guiwindow for my login panel So how to set it vesible and to active the login/register button ? i'm noob at scripting xD

Login = guiCreateWindow(0.2775,0.155,0.5263,0.7933,"Login",true) 
     
    guiWindowSetMovable(Login,false) 
    guiWindowSetSizable(Login,false) 
     
    loginButton = guiCreateButton(0.2257,0.7752,0.5748,0.0462,"Login",true,Login) 
    registerButton = guiCreateButton(0.228,0.8634,0.5701,0.0483,"Register",true,Login) 
    infolbl = guiCreateLabel(0.3159,0.3613,0.3682,0.0483,"Welcome to....server",true,Login) 
    guiLabelSetColor(infolbl,50,100,50) 
    guiLabelSetVerticalAlign(infolbl,"center") 
    guiLabelSetHorizontalAlign(infolbl,"center",false) 
    guiSetFont(infolbl,"default-bold-small") 
    userlbl = guiCreateLabel(0.0665,0.4748,0.2328,0.042,"Your Username : ",true,Login) 
    guiSetFont(userlbl,"default-bold-small") 
    passlabl = guiCreateLabel(0.0665,0.5861,0.228,0.0357,"Your Password : ",true,Login) 
    guiSetFont(passlabl,"default-bold-small") 
    edit_Login = guiCreateEdit(0.3135,0.458,0.5178,0.0588,"",false,Login) 
    edit_password  = guiCreateEdit(0.3135,0.5714,0.5178,0.0588,"",false,Login) 
    logimg = guiCreateStaticImage(0.2423,0.0504,0.5202,0.313,"images/mtalogo.png",true,Login) 
  
Reg = guiCreateWindow(0.6062,0.2617,0.3787,0.6683,"register",true) 
guiSetAlpha(Reg,1) 
AccEdit = guiCreateEdit(0.2541,0.4938,0.5248,0.0449,"",true,Reg) 
Acclbl = guiCreateLabel(0.3333,0.4414,0.3861,0.0424,"account name:",true,Reg) 
guiSetFont(Acclbl,"default-bold-small") 
passEdit = guiCreateEdit(0.2541,0.5885,0.5314,0.0449,"",true,Regwnd) 
passlbl = guiCreateLabel(0.3234,0.5486,0.4026,0.0374,"password:",true,Regwnd) 
guiLabelSetHorizontalAlign(passlbl,"center",false) 
guiSetFont(passlbl,"default-bold-small") 
CpassEdit = guiCreateEdit(0.2475,0.6783,0.538,0.0449,"",true,Reg) 
Cpasslbl = guiCreateLabel(0.3003,0.6334,0.4785,0.0449,"Confirm your password:",true,Reg) 
guiSetFont(Cpasslbl,"default-bold-small") 
emailEdit = guiCreateEdit(0.2475,0.7781,0.5479,0.0449,"",true,Reg) 
Regaccbtn = guiCreateButton(0.3036,0.8803,0.4224,0.0474,"Register",true,Reg) 
guiSetFont(Regaccbtn,"default-bold-small") 
wrglbl = guiCreateLabel(0.2904,0.8279,0.4521,0.0424,"Wrong password ",true,Reg) 
guiLabelSetColor(wrglbl,255,0,0) 
guiLabelSetHorizontalAlign(wrglbl,"center",false) 
guiSetFont(wrglbl,"default-bold-small") 
  
addEventHandler("onClientGUIClick",loginButton,onClickLogin) 
  
function onClickLogin(button,state) 
    if(button == "left" and state == "up") then 
        if (source == loginButton) then 
            username = guiGetText(edit_Login) 
            password = guiGetText(edit_password) 
            triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,enableKickPlayer,attemptedLogins,maxLoginAttempts) 
            xmlFileHandler() 
        end 
    end 
end 
  
  
  addEventHandler('onClientGUIClick', root, 
function() 
                     if source == registerButton then 
                         guiSetVisible(Reg,true) 
                     end 
end 
) 
  
  

Link to comment
there alrready exsist much login panels in comunity. check some codes maybe could help you

You should promote people doing their own scripts, and not using elses.

you are right, but if he is starter with script he can see other scripts to see how work some functions and how use it

yes i download some login panel scripters but i don't understand all the scripter so i like to create my own script so can you say how ??????

Link to comment
triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password,enableKickPlayer,attemptedLogins,maxLoginAttempts) 

enableKickPlayer and attemptedLogins and maxLoginAttempts is not defined anywhere in the code.

Also the function onClickLogin should be above, not below the Event.

addEventHandler("onClientGUIClick",loginButton,onClickLogin) 

Also there no such function with this name xmlFileHandler()

+

You didn't post the server-side (you have?)

and please next time use lua button not Code.

Lj1UB.png

Link to comment

ok ty i see this function when i download a script from community it's is necessary ?

function open_log_reg_pannel() 
if not(isElement(Login_Pannel)) then 
     
    if blackLoginScreen == true then 
        fadeCamera(false,0,0,0,0) 
    end 
    ------------ Window Gui------------- 
 end 
  

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...