Sign in to follow this  
MystoganScripter

Problema con login no me deja registrarme ni logearme

Recommended Posts

Hola bueno quería pedirles si me pueden ayudar con este script que ise lo que pasa es que ya funciona todos los botones y eso pero al momento de logearme me sale que esta mal la contraseña o no existe y al momento de registrarme me sale que ya existe queria saber si me ayudan a repararlo no se si es un problema de algun evento grid o algo por favor llevo todo el dia intentando y no me sale que podra ser el error

cliente:

  

GUIEditor = {
    button = {},
    window = {},
    edit = {},
    staticimage = {},
    label = {}
}

    zero =  ""
    two = ""

        GUIEditor.window[1] = guiCreateWindow(0.38, 0.31, 0.22, 0.32, "Login", true)
        guiWindowSetSizable(GUIEditor.window[1], false)
		showCursor(true)

        logon = guiCreateButton(0.03, 0.82, 0.46, 0.15, "Login", true, GUIEditor.window[1])
        guiSetFont(logon, "default-bold-small")
        GUIEditor.button[2] = guiCreateButton(0.52, 0.82, 0.46, 0.15, "Registro", true, GUIEditor.window[1])
        guiSetFont(GUIEditor.button[2], "default-bold-small")
        GUIEditor.staticimage[1] = guiCreateStaticImage(0.02, 0.06, 0.96, 0.26, ":guieditor/images/plus.png", true, GUIEditor.window[1])
        GUIEditor.label[1] = guiCreateLabel(0.41, 0.34, 0.20, 0.08, "Usuario", true, GUIEditor.window[1])
        guiSetFont(GUIEditor.label[1], "default-bold-small")
        guiLabelSetHorizontalAlign(GUIEditor.label[1], "center", false)
        guiLabelSetVerticalAlign(GUIEditor.label[1], "center")
        GUIEditor.label[2] = guiCreateLabel(0.41, 0.55, 0.20, 0.08, "contraseña", true, GUIEditor.window[1])
        guiSetFont(GUIEditor.label[2], "default-bold-small")
        guiLabelSetHorizontalAlign(GUIEditor.label[2], "center", false)
        guiLabelSetVerticalAlign(GUIEditor.label[2], "center")
        

        GUIEditor.edit[1] = guiCreateEdit(0.28, 0.42, 0.47, 0.11, "", true, GUIEditor.window[1])
        GUIEditor.edit[2] = guiCreateEdit(0.28, 0.65, 0.47, 0.10, "", true, GUIEditor.window[1])  

        guiEditSetMasked ( password, true )
		
		usuario = guiGetText ( GUIEditor.edit[1] )
		guiGetText ( GUIEditor.edit[2] )

		

		

		
     function onregister ( )
      triggerServerEvent("rg",getLocalPlayer(),usuario,contra)
     end
     addEventHandler ( "onClientGUIClick", GUIEditor.button[2], onregister)
		
	function onlogin ( )
      triggerServerEvent("lg",getLocalPlayer(),usuario,contra)
     end
     addEventHandler ( "onClientGUIClick", logon, onlogin)

     function ocu ( )
     guiSetVisible( GUIEditor.window[1], false )
		showCursor(false)
     end
	 addEvent ( "ocultar", true )
     addEventHandler ( "ocultar", getLocalPlayer(), ocu)


     button = guiCreateButton( 0.7, 0.1, 0.2, 0.1, "OK", true )
--Create an edit box and define it as "editBox".
editBox = guiCreateEdit( 0.3, 0.1, 0.4, 0.1, "", true )
guiEditSetMaxLength ( editBox, 128 ) --the max chatbox length is 128, so force this

--setup our function to output the message to the chatbox
function outputEditBox ()
        local text = guiGetText ( editBox )--get the text from the edit box
        outputChatBox ( contra ) --output that text
end
addEventHandler ( "onClientGUIClick", button, outputEditBox )


     y servidor 

function rg(usuario,contra)
	if (addAccount(usuario,contra)) then
		triggerClientEvent(source,"ocultar",source)
		logIn (source,getAccount(usuario,contra),contra)
	else
		outputChatBox("la cuenta ya existe")
end
end
addEvent("rg",true)
addEventHandler("rg",getRootElement(), rg)

function lg(usuario,contra)
 cuenta = getAccount(usuario,contra)
 	if (cuenta) then
		triggerClientEvent(source,"ocultar",source)
		logIn (source,getAccount(usuario,contra),contra)
		outputChatBox("te logeaste correctamente")
		setCameraTarget(source)
	else
		outputChatBox("la cuenta no existe o la contraseña esta mal")
end
end
addEvent("lg",true)
addEventHandler("lg",getRootElement(), lg)




addEventHandler ( "onPlayerJoin", getRootElement(),function ()
 triggerClientEvent(source,"abrir",source)
end)

function setCameraOnPlayerJoin()
     -- slowly fade the camera in to make the screen visible
     fadeCamera(source, true, 5)
     -- set the player's camera to a fixed position, looking at a fixed point
     setCameraMatrix(source, -1568, 540, 80, -400000, 10000000, 99.881813049316)
end
addEventHandler("onPlayerJoin", root, setCameraOnPlayerJoin)
addEventHandler ( "onResourceStart", getRootElement(), setCameraOnPlayerJoin )

    

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.