Mefisto_PL Posted August 28, 2013 Posted August 28, 2013 I do my login panel with wiki help.. And it doesn't working. It don't log me in and I can't register account. When I click on my label which I want to use as button then nothing happened, but when I create gui button and push him then window disappeared. Client: GUIAddons = { button = {}, checkbox = {}, staticimage = {}, edit = {}, label = {}, memo = {} } function createLoginGUI() GUIAddons.staticimage[1] = guiCreateStaticImage(0.21, 0.22, 0.61, 0.64, "Files/Images/blank.png", true) guiSetAlpha(GUIAddons.staticimage[1], 0.87) guiSetProperty(GUIAddons.staticimage[1], "ImageColours", "tl:FF000000 tr:FF000000 bl:FF000000 br:FF000000") GUIAddons.staticimage[2] = guiCreateStaticImage(0.00, 0.00, 1.00, 0.08, "Files/Images/blank.png", true, GUIAddons.staticimage[1]) guiSetProperty(GUIAddons.staticimage[2], "ImageColours", "tl:FF009EFF tr:FF009EFF bl:FF009EFF br:FF009EFF") GUIAddons.label[1] = guiCreateLabel(0.00, 0.00, 1.00, 1.00, "Please log in.", true, GUIAddons.staticimage[2]) guiSetFont(GUIAddons.label[1], "clear-normal") guiLabelSetHorizontalAlign(GUIAddons.label[1], "center", false) guiLabelSetVerticalAlign(GUIAddons.label[1], "center") GUIAddons.label[2] = guiCreateLabel(0.33, 0.10, 0.33, 0.05, "Account:", true, GUIAddons.staticimage[1]) guiSetFont(GUIAddons.label[2], "default-bold-small") guiLabelSetHorizontalAlign(GUIAddons.label[2], "center", false) guiLabelSetVerticalAlign(GUIAddons.label[2], "center") AccountEdit = guiCreateEdit(0.33, 0.19, 0.33, 0.07, "", true, GUIAddons.staticimage[1]) guiEditSetMaxLength(AccountEdit, 22) GUIAddons.label[3] = guiCreateLabel(0.33, 0.28, 0.33, 0.05, "Password:", true, GUIAddons.staticimage[1]) guiSetFont(GUIAddons.label[3], "default-bold-small") guiLabelSetHorizontalAlign(GUIAddons.label[3], "center", false) guiLabelSetVerticalAlign(GUIAddons.label[3], "center") PasswordEdit = guiCreateEdit(0.33, 0.35, 0.33, 0.07, "", true, GUIAddons.staticimage[1]) guiEditSetMasked(PasswordEdit, true) guiEditSetMaxLength(PasswordEdit, 22) GUIAddons.staticimage[3] = guiCreateStaticImage(0.33, 0.53, 0.33, 0.08, "Files/Images/blank.png", true, GUIAddons.staticimage[1]) guiSetProperty(GUIAddons.staticimage[3], "ImageColours", "tl:FF004D7D tr:FF004D7D bl:FF004D7D br:FF004D7D") GUIAddons.label[4] = guiCreateLabel(0.00, 0.00, 1.00, 1.00, "Join the game !", true, GUIAddons.staticimage[3]) guiLabelSetHorizontalAlign(GUIAddons.label[4], "center", false) guiLabelSetVerticalAlign(GUIAddons.label[4], "center") addEventHandler ( "onClientGUIClick", GUIAddons.label[4], clientSubmitingLogin ) GUIAddons.label[5] = guiCreateLabel(0.00, 0.46, 1.00, 0.03, "Just log in !", true, GUIAddons.staticimage[1]) guiLabelSetHorizontalAlign(GUIAddons.label[4], "center", false) guiLabelSetVerticalAlign(GUIAddons.label[4], "center") GUIAddons.memo[1] = guiCreateMemo(0.03, 0.64, 0.94, 0.32, "", true, GUIAddons.staticimage[1]) guiMemoSetReadOnly(GUIAddons.memo[1], true) guiSetVisible(GUIAddons.staticimage[1], false) end addEventHandler ( "onClientResourceStart", resourceRoot, function() createLoginGUI () if ( GUIAddons.staticimage[1] ~= nil ) then guiSetVisible ( GUIAddons.staticimage[1], true ) end showChat ( false ) showCursor ( true ) guiSetInputEnabled ( true ) end ) function clientSubmitingLogin ( button, state ) if button == "left" and state == "up" then local username = guiGetText ( AccountEdit ) local password = guiGetText ( PasswordEdit ) if username and password then triggerServerEvent ( "submitLogin", getRootElement(), username, password ) guiSetInputEnabled ( false ) guiSetVisible ( GUIAddons.staticimage[1], false ) showCursor ( false ) else guiSetText( GUIAddons.label[5], "Please enter your Account Name and Password !" ) end end end function setErrorLabelText ( ) guiSetText ( GUIAddons.label[5], text ) end addEvent ( "setErrorText", true ) addEventHandler ( "setErrorText", getRootElement(), setErrorLabelText ) Server: function loginHandler ( username,password ) if username and password then if ( thePlayer ) then spawnPlayer ( thePlayer, 1959.55, -1714.46, 10 ) fadeCamera ( thePlayer, true ) setCameraTarget ( thePlayer, thePlayer ) outputChatBox ( "[YAG] Welcome to our server ! You logged as " .. username .. ". Just follow the rules and have fun !", thePlayer ) end else triggerClientEvent ( thePlayer, "setErrorText", "Invalid Account or Password. Please Reconnect." ) end end addEvent("submitLogin",true) addEventHandler("submitLogin",root,loginHandler)
xXMADEXx Posted August 29, 2013 Posted August 29, 2013 Any debug errors? And make sure the script haves access to: "function.addAccount"
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now