Jump to content

GUI issue


Recommended Posts

Hi, I've created a login panel GUI but for some reason it just wont appear on your screen after you type /lp.

Code:

function loadLoginPanel() 
    -- config stuff 
    showChat(false) 
    showCursor(true) 
    fadeCamera(true, 5) 
    setCameraMatrix(2016.966796875, -1786.8369140625, 32.701007843018, 1947.2470703125, -1751.3662109375, 13.3828125) 
    guiSetInputEnabled(true) 
    local Width,Height = 350,350 
    local X = (sWidth/2) - (Width/2) 
    local Y = (sHeight/5) - (Height/5) 
    -- 
         
    -- login panel 
    login_panel = guiCreateStaticImage( X, Y + 110, 350, 350, "img/box.png", false ) 
    --logo = guiCreateStaticImage( X + 75,Y + 115,200,80, "img/logo.png", false ) 
         
    title = guiCreateLabel( X + 23, Y + 395, 301, 20, "Welcome to Los Santos County Roleplay!", false) 
    guiLabelSetVerticalAlign(title,"center") 
    guiLabelSetHorizontalAlign(title,"center",false) 
  
    bLogin = guiCreateButton ( X + 23, Y + 349, 143, 45, "Login", false) 
    lUsername = guiCreateLabel(X + 20,Y + 200,310,20,"Username",false) 
    tUsername = guiCreateEdit(X + 20,Y + 220,310,35,"",false) 
    lPassword = guiCreateLabel(X + 20,Y + 275,310,20,"Password",false) 
    tPassword = guiCreateEdit(X + 20,Y + 295,310,35,"",false) 
    guiEditSetMaxLength ( tUsername,25) 
    guiEditSetMaxLength ( tPassword,25) 
    guiEditSetMasked ( tPassword, true ) 
    guiSetProperty( tPassword, 'MaskCodepoint', '8226' ) 
  
    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(X + 230,Y + 275,100,20,"(Remember me!)",false,false) 
    guiSetFont(checkbox_save,"default-small") 
  
    login_tab_error_msg = guiCreateLabel(X,Y + 325,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") 
  
    login_tab_authen_msg = guiCreateLabel(X,Y + 325,364,31,"Authen_login_tab",false) 
    guiLabelSetColor(login_tab_authen_msg,0,255,0) 
    guiLabelSetVerticalAlign(login_tab_authen_msg,"center") 
    guiLabelSetHorizontalAlign(login_tab_authen_msg,"center",false) 
    guiSetFont(login_tab_authen_msg,"default-bold-small") 
  
    shSignup = guiCreateButton ( X + 182, Y + 349, 143, 45, "Register", false) 
         
    lbl_reg_top_info = guiCreateLabel(X + 20,Y + 180,310,35,"",false) 
    guiLabelSetColor(lbl_reg_top_info,255,234,55) 
    guiLabelSetVerticalAlign(lbl_reg_top_info,"center") 
    guiLabelSetHorizontalAlign(lbl_reg_top_info,"center",false) 
    guiSetFont(lbl_reg_top_info,"default-bold-small") 
    guiSetVisible(lbl_reg_top_info,false) 
  
    edit_account_name = guiCreateEdit(X + 20,Y + 215,310,35,"",false) 
    edit_account_name_l = guiCreateLabel(X + 20,Y + 195,310,35,"Account Name",false) 
    guiEditSetMaxLength ( edit_account_name,25) 
    guiSetVisible(edit_account_name,false) 
    guiSetVisible(edit_account_name_l,false) 
    addEventHandler("onClientGUIChanged", edit_account_name, resetRegButtons) 
  
    edit__reg_tab_password = guiCreateEdit(X + 20,Y + 290,310,35,"",false) 
    edit__reg_tab_password_l = guiCreateLabel(X + 20,Y + 270,310,35,"Password",false) 
    guiEditSetMaxLength ( edit__reg_tab_password,25) 
    guiEditSetMasked ( edit__reg_tab_password, true ) 
    guiSetProperty(edit__reg_tab_password, 'MaskCodepoint', '8226') 
    guiSetVisible(edit__reg_tab_password,false) 
    guiSetVisible(edit__reg_tab_password_l,false) 
    addEventHandler("onClientGUIChanged", edit__reg_tab_password, resetRegButtons) 
  
    edit__reg_tab_Repassword = guiCreateEdit(X + 20,Y + 365,310,35,"",false) 
    edit__reg_tab_Repassword_l = guiCreateLabel(X + 20,Y + 345,310,35,"Confirm Password",false) 
    guiEditSetMaxLength ( edit__reg_tab_Repassword,25) 
    guiEditSetMasked ( edit__reg_tab_Repassword, true ) 
    guiSetProperty(edit__reg_tab_Repassword, 'MaskCodepoint', '8226') 
    guiSetVisible(edit__reg_tab_Repassword,false) 
    guiSetVisible(edit__reg_tab_Repassword_l,false) 
    guiSetEnabled (edit__reg_tab_Repassword, true) 
  
    edit__reg_tab_email = guiCreateEdit(X + 20,Y + 435,310,35,"",false) 
    edit__reg_tab_email_l = guiCreateLabel(X + 20,Y + 415,310,35,"Email",false) 
    guiEditSetMaxLength ( edit__reg_tab_email,100) 
    guiSetVisible(edit__reg_tab_email,false) 
    guiSetVisible(edit__reg_tab_email_l,false) 
    guiSetEnabled (edit__reg_tab_email, true) 
  
    shRegister2 = guiCreateButton ( X + 182, Y + 401+6+offsetY, 143, 45, "Submit", false ) 
    guiSetVisible(shRegister2,false) 
  
    shCancel = guiCreateButton ( X + 23, Y + 401+6+offsetY, 143, 45, "Back", false ) 
    guiSetVisible(shCancel,false) 
    showCursor(true) 
  
    guiSetText(login_tab_error_msg, "") 
    guiSetText(login_tab_authen_msg, "") 
end 
addCommandHandler("lp", loadLoginPanel) 

Link to comment

You should be triggering a even from server side for the player and then it will OPEN only for the player you triggered.

triggerClientEvent

addCommandHandler

guiSetVisible

addEvent

addEventHandler

guiSetVisible on every part of gui to false and add a onClientResourceStart event.

Then make another function for addEvent, addEventHandler and set the cursor on.etc

Link to comment
  
function loadLoginPanel() 
    -- config stuff 
     
    spawnPlayer(getLocalPlayer(), 0, 0, 0) 
    showChat(false) 
    showCursor(true) 
    fadeCamera(true, 5) 
    setCameraMatrix(2016.966796875, -1786.8369140625, 32.701007843018, 1947.2470703125, -1751.3662109375, 13.3828125) 
     
     
    guiSetInputEnabled(true) 
    local Width,Height = 350,350 
    local X = (sWidth/2) - (Width/2) 
    local Y = (sHeight/5) - (Height/5) 
    -- 
         
    -- login panel 
    login_panel = guiCreateStaticImage( X, Y + 110, 350, 350, "img/box.png", false ) 
    --logo = guiCreateStaticImage( X + 75,Y + 115,200,80, "img/logo.png", false ) 
         
    title = guiCreateLabel( X + 23, Y + 395, 301, 20, "Welcome to Los Santos County Roleplay!", false) 
    guiLabelSetVerticalAlign(title,"center") 
    guiLabelSetHorizontalAlign(title,"center",false) 
  
    bLogin = guiCreateButton ( X + 23, Y + 349, 143, 45, "Login", false) 
    lUsername = guiCreateLabel(X + 20,Y + 200,310,20,"Username",false) 
    tUsername = guiCreateEdit(X + 20,Y + 220,310,35,"",false) 
    lPassword = guiCreateLabel(X + 20,Y + 275,310,20,"Password",false) 
    tPassword = guiCreateEdit(X + 20,Y + 295,310,35,"",false) 
    guiEditSetMaxLength ( tUsername,25) 
    guiEditSetMaxLength ( tPassword,25) 
    guiEditSetMasked ( tPassword, true ) 
    guiSetProperty( tPassword, 'MaskCodepoint', '8226' ) 
  
    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(X + 230,Y + 275,100,20,"(Remember me!)",false,false) 
    guiSetFont(checkbox_save,"default-small") 
  
    login_tab_error_msg = guiCreateLabel(X,Y + 325,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") 
  
    login_tab_authen_msg = guiCreateLabel(X,Y + 325,364,31,"Authen_login_tab",false) 
    guiLabelSetColor(login_tab_authen_msg,0,255,0) 
    guiLabelSetVerticalAlign(login_tab_authen_msg,"center") 
    guiLabelSetHorizontalAlign(login_tab_authen_msg,"center",false) 
    guiSetFont(login_tab_authen_msg,"default-bold-small") 
  
    shSignup = guiCreateButton ( X + 182, Y + 349, 143, 45, "Register", false) 
         
    lbl_reg_top_info = guiCreateLabel(X + 20,Y + 180,310,35,"",false) 
    guiLabelSetColor(lbl_reg_top_info,255,234,55) 
    guiLabelSetVerticalAlign(lbl_reg_top_info,"center") 
    guiLabelSetHorizontalAlign(lbl_reg_top_info,"center",false) 
    guiSetFont(lbl_reg_top_info,"default-bold-small") 
    guiSetVisible(lbl_reg_top_info,false) 
  
    edit_account_name = guiCreateEdit(X + 20,Y + 215,310,35,"",false) 
    edit_account_name_l = guiCreateLabel(X + 20,Y + 195,310,35,"Account Name",false) 
    guiEditSetMaxLength ( edit_account_name,25) 
    guiSetVisible(edit_account_name,false) 
    guiSetVisible(edit_account_name_l,false) 
    addEventHandler("onClientGUIChanged", edit_account_name, resetRegButtons) 
  
    edit__reg_tab_password = guiCreateEdit(X + 20,Y + 290,310,35,"",false) 
    edit__reg_tab_password_l = guiCreateLabel(X + 20,Y + 270,310,35,"Password",false) 
    guiEditSetMaxLength ( edit__reg_tab_password,25) 
    guiEditSetMasked ( edit__reg_tab_password, true ) 
    guiSetProperty(edit__reg_tab_password, 'MaskCodepoint', '8226') 
    guiSetVisible(edit__reg_tab_password,false) 
    guiSetVisible(edit__reg_tab_password_l,false) 
    addEventHandler("onClientGUIChanged", edit__reg_tab_password, resetRegButtons) 
  
    edit__reg_tab_Repassword = guiCreateEdit(X + 20,Y + 365,310,35,"",false) 
    edit__reg_tab_Repassword_l = guiCreateLabel(X + 20,Y + 345,310,35,"Confirm Password",false) 
    guiEditSetMaxLength ( edit__reg_tab_Repassword,25) 
    guiEditSetMasked ( edit__reg_tab_Repassword, true ) 
    guiSetProperty(edit__reg_tab_Repassword, 'MaskCodepoint', '8226') 
    guiSetVisible(edit__reg_tab_Repassword,false) 
    guiSetVisible(edit__reg_tab_Repassword_l,false) 
    guiSetEnabled (edit__reg_tab_Repassword, true) 
  
    edit__reg_tab_email = guiCreateEdit(X + 20,Y + 435,310,35,"",false) 
    edit__reg_tab_email_l = guiCreateLabel(X + 20,Y + 415,310,35,"Email",false) 
    guiEditSetMaxLength ( edit__reg_tab_email,100) 
    guiSetVisible(edit__reg_tab_email,false) 
    guiSetVisible(edit__reg_tab_email_l,false) 
    guiSetEnabled (edit__reg_tab_email, true) 
  
    shRegister2 = guiCreateButton ( X + 182, Y + 401+6+offsetY, 143, 45, "Submit", false ) 
    guiSetVisible(shRegister2,false) 
  
    shCancel = guiCreateButton ( X + 23, Y + 401+6+offsetY, 143, 45, "Back", false ) 
    guiSetVisible(shCancel,false) 
    showCursor(true) 
  
    guiSetText(login_tab_error_msg, "") 
    guiSetText(login_tab_authen_msg, "") 
  
end 
addEventHandler("onClientPlayerJoin", getRootElement(), loadLoginPanel) 

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...