iFoReX Posted August 5, 2012 Share Posted August 5, 2012 porque esto no me funciona ? cl-side GUIEditor_Button = {} GUIEditor_Edit = {} GUIEditor_Image = {} addEventHandler("onClientResourceStart",resourceRoot,function() GUIEditor_Button[1] = guiCreateButton(0.7962,0.1383,0.0388,0.025,"cerrar",true) guiSetAlpha(GUIEditor_Button[1],0) GUIEditor_Image[1] = guiCreateStaticImage(0.2438,0.13,0.58,0.655,"images/windows7.jpg",true) addEventHandler("onClientRender",root,loginB) addEventHandler("onClientRender",root,registerB) GUIEditor_Button[2] = guiCreateButton(0.2625,0.31,0.0575,0.0317,"LOGIN",true) guiSetAlpha(GUIEditor_Button[2],0) GUIEditor_Button[3] = guiCreateButton(0.2637,0.345,0.075,0.0317,"REGISTER",true) guiSetAlpha(GUIEditor_Button[3],0) end ) -- Direct X Drawing function loginB() dxDrawText("-Login",212.0,186.0,249.0,203.0,tocolor(0,0,0,160),1.0,"sans","left","top",false,false,true) end function loginBC() dxDrawText("-Login",212.0,186.0,249.0,203.0,tocolor(34,162,248,160),1.0,"sans","left","top",false,false,true) end function registerB() dxDrawText("-Register",211.0,208.0,271.0,224.0,tocolor(0,0,0,160),1.0,"sans","left","top",false,false,true) end function registerBC() dxDrawText("-Register",211.0,208.0,271.0,224.0,tocolor(34,162,248,160),1.0,"sans","left","top",false,false,true) end addEventHandler("onClientMouseEnter",root,function() if source == GUIEditor_Button[2] then removeEventHandler("onClientRender",root,loginB) addEventHandler("onClientRender",root,registerB) if source == GUIEditor_Button[3] then removeEventHandler("onClientRender",root,registerB) addEventHandler("onClientRender",root,loginB) end end end ) addEventHandler("onClientMouseLeave",root,function() if source == GUIEditor_Button[3] then removeEventHandler("onClientRender",root,loginB) addEventHandler("onClientRender",root,registerB) if source == GUIEditor_Button[2] then removeEventHandler("onClientRender",root,registerB) addEventHandler("onClientRender",root,loginB) end end end ) function registerW() dxDrawText("register",426.0,366.0,518.0,389.0,tocolor(0,0,0,255),1.5,"default-bold","left","top",false,true,true) dxDrawRectangle(423.0,361.0,112.0,34.0,tocolor(30,130,204,190),true) dxDrawText("CONFIRM PASSWORD",388.0,306.0,565.0,321.0,tocolor(0,0,0,190),0.5,"bankgothic","left","top",false,false,true) dxDrawText("USERNAME",429.0,189.0,526.0,205.0,tocolor(0,0,0,190),0.5,"bankgothic","left","top",false,false,true) dxDrawText("PASSWORD",427.0,250.0,524.0,266.0,tocolor(0,0,0,190),0.5,"bankgothic","left","top",false,false,true) dxDrawText("PAGE",205.0,83.0,318.0,113.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,true) GUIEditor_Edit[1] = guiCreateEdit(0.5163,0.3617,0.1663,0.0433,"",true) guiSetAlpha(GUIEditor_Edit[1],1) GUIEditor_Edit[2] = guiCreateEdit(0.5138,0.545,0.1663,0.0433,"",true) GUIEditor_Edit[3] = guiCreateEdit(0.5175,0.45,0.1663,0.0433,"",true) GUIEditor_Button[4] = guiCreateButton(0.5263,0.6017,0.1462,0.0567,"REGISTERC",true) guiSetAlpha(GUIEditor_Button[4],0) end function loginW() dxDrawText("login",426.0,366.0,518.0,389.0,tocolor(0,0,0,255),1.5,"default-bold","left","top",false,true,true) dxDrawRectangle(423.0,361.0,112.0,34.0,tocolor(30,130,204,190),true) dxDrawText("USERNAME",429.0,189.0,526.0,205.0,tocolor(0,0,0,190),0.5,"bankgothic","left","top",false,false,true) dxDrawText("PASSWORD",427.0,250.0,524.0,266.0,tocolor(0,0,0,190),0.5,"bankgothic","left","top",false,false,true) dxDrawText("PAGE",205.0,83.0,318.0,113.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,true) GUIEditor_Edit[4] = guiCreateEdit(0.5163,0.3617,0.1663,0.0433,"",true) guiSetAlpha(GUIEditor_Edit[1],1) GUIEditor_Button[5] = guiCreateButton(0.5263,0.6017,0.1462,0.0567,"LOGINC",true) guiSetAlpha(GUIEditor_Button[4],0) GUIEditor_Edit[5] = guiCreateEdit(0.5138,0.545,0.1663,0.0433,"",true) end addEventHandler("onClientGUIClick",root,function() if source == GUIEditor_Button[2] then addEventHandler("onClientRender",root,loginW) removeEventHandler("onClientRender",root,registerW) elseif source == GUIEditor_Button[3] then removeEventHandler("onClientRender",root,loginW) addEventHandler("onClientRender",root,registerW) end end ) function onClickBtnLogin(button,state) if(button == "left" and state == "up") then if (source == GUIEditor_Button[5]) then local username = guiGetText(GUIEditor_Edit[4]) local password = guiGetText(GUIEditor_Edit[5]) triggerServerEvent("submitLoginEM",getLocalPlayer(),username,password) end end end addEventHandler("onClientGUIClick",root,onClickBtnLogin) function onClickBtnRegister(button,state) if(button == "left" and state == "up") then if (source == GUIEditor_Button[4]) then local username = guiGetText(GUIEditor_Edit[1]) local password = guiGetText(GUIEditor_Edit[2]) local passwordConfirm = guiGetText(GUIEditor_Edit[3]) triggerServerEvent("cuenta",getLocalPlayer(),username,password,passwordConfirm) end end end addEventHandler("onClientGUIClick",root,onClickBtnRegister) addEvent("closeGUI",true) addEventHandler("closeGUI",root,function() removeEventHandler("onClientRender",root,loginB) removeEventHandler("onClientRender",root,loginBC) removeEventHandler("onClientRender",root,registerB) removeEventHandler("onClientRender",root,registerBC) removeEventHandler("onClientRender",root,registerW) removeEventHandler("onClientRender",root,loginB) guiSetVisible(GUIEditor_Image[1],false) guiSetVisible(GUIEditor_Button[1],false) guiSetVisible(GUIEditor_Button[2],false) guiSetVisible(GUIEditor_Button[3],false) end ) addEvent("cuenta", true) addEventHandler("cuenta", root, function ( username, password, passwordConfirm ) if ( password ~= "" and password ~= nil and username ~= "" and username ~= nil and password == passwordConfirm ) then if ( not getAccount ( username ) ) then local accountAdded = addAccount ( username, password ) if ( accountAdded ) then outputChatBox ( "Gracias " .. getPlayerName ( source ) .. ", Ya estas Registrado y loggeado", source ) outputChatBox ( "Tu Character se a creado con exito !.", source ) triggerClientEvent ( source, "closeGUI", source ) logIn ( source, username , password ) end else outputChatBox ( "Error creando la Cuenta por Favor contacta a un Admin.", source ) end else outputChatBox ( "Esta Cuenta Ya Existe..", source ) end else outputChatBox ( "Porfavor Pon tus datos Correctos.", source ) end ) function loginHandler(username,password) if ( username ) then local acc = getAccount(username, password) if (acc) then logIn ( source, acc, password ) fadeCamera(source, true) setCameraTarget(source) triggerClientEvent ( source, "closeGUI", source ) outputChatBox("Disfrutalo", source) else outputChatBox("invalid username and password. Please re-connect and try again.", source) end end end addEvent("submitLoginEM",true) addEventHandler("submitLoginEM",root, loginHandler) Link to comment
Castillo Posted August 5, 2012 Share Posted August 5, 2012 Talvez si dieras mas informacion te podriamos ayudar. Link to comment
iFoReX Posted August 5, 2012 Author Share Posted August 5, 2012 me aparece error en el srv side, con un END Link to comment
Castillo Posted August 5, 2012 Share Posted August 5, 2012 Tenes un lio con los 'if' y 'else'. addEvent ( "cuenta", true ) addEventHandler ( "cuenta", root, function ( username, password, passwordConfirm ) if ( password ~= "" and password ~= nil and username ~= "" and username ~= nil and password == passwordConfirm ) then if ( not getAccount ( username ) ) then local accountAdded = addAccount ( username, password ) if ( accountAdded ) then outputChatBox ( "Gracias " .. getPlayerName ( source ) .. ", Ya estas Registrado y loggeado", source ) outputChatBox ( "Tu Character se a creado con exito !.", source ) triggerClientEvent ( source, "closeGUI", source ) logIn ( source, username , password ) else outputChatBox ( "Error creando la Cuenta por Favor contacta a un Admin.", source ) end else outputChatBox ( "Esta Cuenta Ya Existe..", source ) end else outputChatBox ( "Porfavor Pon tus datos Correctos.", source ) end end ) function loginHandler(username,password) if ( username ) then local acc = getAccount(username, password) if (acc) then logIn ( source, acc, password ) fadeCamera(source, true) setCameraTarget(source) triggerClientEvent ( source, "closeGUI", source ) outputChatBox("Disfrutalo", source) else outputChatBox("invalid username and password. Please re-connect and try again.", source) end end end addEvent("submitLoginEM",true) addEventHandler("submitLoginEM",root, loginHandler) Link to comment
Recommended Posts