MisterQuestions Posted August 1, 2014 Posted August 1, 2014 Hi all im mading a login panel, but i dont know how to make get text from label of username and password, and send the inserted text to the server side to player login or register can any one help me?
Karuzo Posted August 1, 2014 Posted August 1, 2014 local text = guiGetText(youreditbox) triggerServerEvent("Login",localPlayer,text)
MisterQuestions Posted August 1, 2014 Author Posted August 1, 2014 Thanks, but now? how to make like a event like "OnClienGUIClick" if im using dxrectangles on the panel?
Max+ Posted August 1, 2014 Posted August 1, 2014 addEventHandler ( 'onClientGUIClick', resourceRoot, function ( ) if ( source == button ) then local user = guiGetText ( Edit[1] ) local pass = guiGetText ( Edit[2] ) triggerServerEvent ( 'Login', localPlayer, user, pass ) end end )
MisterQuestions Posted August 1, 2014 Author Posted August 1, 2014 Hey somebody help me i got an error : Loading script failed: login\client.lua:1: ' expected near '(' Here's my code..: function() LoginWindow = guiCreateWindow(370, 257, 306, 213, "cP~//Login Panel", false) guiWindowSetMovable(LoginWindow, false) guiWindowSetSizable(LoginWindow, false) userlabel = guiCreateLabel(21, 49, 75, 26, "Username:", false, LoginWindow) local font_0 = guiCreateFont(":font/digital.ttf") guiSetFont(userlabel, font_0) passlabel = guiCreateLabel(21, 93, 75, 26, "Password:", false, LoginWindow) guiSetFont(passlabel, font_0) useredit = guiCreateEdit(86, 49, 164, 30, "", false, LoginWindow) passedit = guiCreateEdit(86, 89, 164, 30, "", false, LoginWindow) registerbutton = guiCreateButton(37, 142, 102, 42, "Register", false, LoginWindow) guiSetFont(registerbutton, font_0) loginbutton = guiCreateButton(158, 142, 102, 42, "Login", false, LoginWindow) guiSetFont(loginbutton, font_0) end function ImagenFondo() dxDrawImage(1, 0, 1023, 768, ":image/fondo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end addEventHandler("onClientResourceStart",resourceRoot, function Login () local PlayerUser = guiGetText ( useredit ) local PlayerPass = guiGetText ( passedit ) if PlayerUser ~= "" and PlayerPass ~= "" then triggerServerEvent("onRequestLogin",getLocalPlayer(),PlayerUser,PlayerPass) else outputChatBox("#FF9e00Can't Login, if the problem persists contact an admin.",255,255,255,true) end end function Register () local PlayerUser = guiGetText ( useredit ) local PlayerPass = guiGetText ( passedit ) if PlayerUser ~= "" and PlayerPass ~= "" then triggerServerEvent("onRequestRegister",getLocalPlayer(),login,pass,conf) else outputChatBox("#FF9e00Can't Register, if the problem persists contact an admin.",255,255,255,true) end end function xmlCheckFile() local xmlFile = xmlLoadFile("account.xml") if not xmlFile then xmlFile = xmlCreateFile("account.xml","settings") xmlNodeSetAttribute(xmlFile,"save",tostring(false)) xmlNodeSetAttribute(xmlFile,"username","") xmlNodeSetAttribute(xmlFile,"password","") end xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) end function loadXMLInfo() local xmlFile = xmlLoadFile("account.xml") if xmlFile then local login = xmlNodeGetAttribute(xmlFile,"username") local password = xmlNodeGetAttribute(xmlFile,"password") local save = xmlNodeGetAttribute(xmlFile,"save") if save == "true" then guiSetText(loginEdit,login) guiSetText(passwordEdit,password) guiCheckBoxSetSelected(remember, true) end end xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) end function saveXmlFile() local xmlFile = xmlLoadFile("account.xml") if not xmlFile then xmlFile = xmlCreateFile("account.xml") end xmlNodeSetAttribute(xmlFile,"username",tostring(guiGetText(loginEdit))) xmlNodeSetAttribute(xmlFile,"password",tostring(guiGetText(passwordEdit))) if (guiCheckBoxGetSelected(remember)) then xmlNodeSetAttribute(xmlFile,"save",tostring(true)) else xmlNodeSetAttribute(xmlFile,"save",tostring(false)) end xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) end
Max+ Posted August 1, 2014 Posted August 1, 2014 LoginWindow = guiCreateWindow(370, 257, 306, 213, "cP~//Login Panel", false) guiWindowSetMovable(LoginWindow, false) guiWindowSetSizable(LoginWindow, false) userlabel = guiCreateLabel(21, 49, 75, 26, "Username:", false, LoginWindow) local font_0 = guiCreateFont(":font/digital.ttf") guiSetFont(userlabel, font_0) passlabel = guiCreateLabel(21, 93, 75, 26, "Password:", false, LoginWindow) guiSetFont(passlabel, font_0) useredit = guiCreateEdit(86, 49, 164, 30, "", false, LoginWindow) passedit = guiCreateEdit(86, 89, 164, 30, "", false, LoginWindow) registerbutton = guiCreateButton(37, 142, 102, 42, "Register", false, LoginWindow) guiSetFont(registerbutton, font_0) loginbutton = guiCreateButton(158, 142, 102, 42, "Login", false, LoginWindow) guiSetFont(loginbutton, font_0) function ImagenFondo() dxDrawImage(1, 0, 1023, 768, ":image/fondo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end addEventHandler("onClientResourceStart",resourceRoot,ImagenFondo ) function Login () local PlayerUser = guiGetText ( useredit ) local PlayerPass = guiGetText ( passedit ) if PlayerUser ~= "" and PlayerPass ~= "" then triggerServerEvent("onRequestLogin",getLocalPlayer(),PlayerUser,PlayerPass) else outputChatBox("#FF9e00Can't Login, if the problem persists contact an admin.",255,255,255,true) end end function Register () local PlayerUser = guiGetText ( useredit ) local PlayerPass = guiGetText ( passedit ) if PlayerUser ~= "" and PlayerPass ~= "" then triggerServerEvent("onRequestRegister",getLocalPlayer(),login,pass,conf) else outputChatBox("#FF9e00Can't Register, if the problem persists contact an admin.",255,255,255,true) end end function xmlCheckFile() local xmlFile = xmlLoadFile("account.xml") if not xmlFile then xmlFile = xmlCreateFile("account.xml","settings") xmlNodeSetAttribute(xmlFile,"save",tostring(false)) xmlNodeSetAttribute(xmlFile,"username","") xmlNodeSetAttribute(xmlFile,"password","") end xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) end function loadXMLInfo() local xmlFile = xmlLoadFile("account.xml") if xmlFile then local login = xmlNodeGetAttribute(xmlFile,"username") local password = xmlNodeGetAttribute(xmlFile,"password") local save = xmlNodeGetAttribute(xmlFile,"save") if save == "true" then guiSetText(loginEdit,login) guiSetText(passwordEdit,password) guiCheckBoxSetSelected(remember, true) end end xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) end function saveXmlFile() local xmlFile = xmlLoadFile("account.xml") if not xmlFile then xmlFile = xmlCreateFile("account.xml") end xmlNodeSetAttribute(xmlFile,"username",tostring(guiGetText(loginEdit))) xmlNodeSetAttribute(xmlFile,"password",tostring(guiGetText(passwordEdit))) if (guiCheckBoxGetSelected(remember)) then xmlNodeSetAttribute(xmlFile,"save",tostring(true)) else xmlNodeSetAttribute(xmlFile,"save",tostring(false)) end xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) end
Max+ Posted August 1, 2014 Posted August 1, 2014 Still saying the same why? no way i fixed it , make sure it's utf 8 without bom in NP++
MisterQuestions Posted August 1, 2014 Author Posted August 1, 2014 Now work's, but doesn't generate the dxDrawImage why?
MisterQuestions Posted August 1, 2014 Author Posted August 1, 2014 Forget it i just added Event "onClientRender"
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