Jump to content

Problema con dxDrawText


LPM//Bruno

Recommended Posts

Hola, tengo un login panel el cual con unos dxDrawText hice que mostrara mensajes de error como por ejemplo Nombre de usuario y contraseña incorrecta, y mensajes de exito como Registro exitoso, etc.. El problema es que cuando yo inicio sesion, luego alguien se conecta y inicia sesion y veo esos dxDraw yo y todas las personas que iniciaron sesion también, que puedo hacer?

Code:

 

textoLogin = ""
textoLoginErr = ""
textoRegErr = ""
textoNoUserNoPassword = ""
textoRegSucess = ""

addEventHandler("onClientRender", getRootElement(getLocalPlayer()), 
	function()	




		loginSucess = dxDrawText(textoLogin, (426/1024)*sWidth, (328/768)*sHeight, (732/1024)*sWidth , (258/768)*sHeight , tocolor(255, 255, 255, 255), (sWidth/1024)*1.5, "default", "left", "top", false, false, true, false, false)

        loginIncorrect = dxDrawText(textoLoginErr, (369/1024)*sWidth, (328/768)*sHeight, (732/1024)*sWidth , (258/768)*sHeight , tocolor(255, 255, 255, 255), (sWidth/1024)*1.5, "default", "left", "top", false, false, true, false, false)

		registroSuccess = dxDrawText(textoRegSucess, (378/1024)*sWidth, (328/768)*sHeight, (732/1024)*sWidth , (258/768)*sHeight , tocolor(255, 255, 255, 255), (sWidth/1024)*1.5, "default", "left", "top", false, false, true, false, false)

		registroErr = dxDrawText(textoRegErr, (418/1024)*sWidth, (328/768)*sHeight, (732/1024)*sWidth , (258/768)*sHeight , tocolor(255, 255, 255, 255), (sWidth/1024)*1.5, "default", "left", "top", false, false, true, false, false)

		NoUserNoPw = dxDrawText(textoNoUserNoPassword, (371/1024)*sWidth, (328/768)*sHeight, (732/1024)*sWidth , (258/768)*sHeight , tocolor(255, 255, 255, 255), (sWidth/1024)*1.5, "default", "left", "top", false, false, true, false, false)

		
	end
 )

addEventHandler("onClientRender", getRootElement(), drawLogo) 

addEvent("onClientPlayerLogin", true)
addEventHandler("onClientPlayerLogin", root,
	function()
		textoLogin = "Iniciando sesion."
		playSound ("media/bell1.wav",false)
		setTimer ( function() textoLogin = "Iniciando sesion.." end, 1000, 1 )
		setTimer ( function() textoLogin = "Iniciando sesion..." end, 2000, 1 )
	    setTimer ( function() destroyElement(initBrowser) removeEventHandler("onClientRender", getRootElement(), drawLogo)  showCursor(false) textoLogin = "" end, 4000, 1 )

	end
)

function cmsg(login, password, command)
	if (command == "login") then
		triggerServerEvent("login", resourceRoot, login, password)
	elseif (command == "register") then
		triggerServerEvent("register", resourceRoot, login, password)
	end
end
addEvent("cmsg", true)
addEventHandler("cmsg", root, cmsg)


function funcLoginErr(username, password)
	textoLoginErr = "Usuario o contraseña incorrecta"
	setTimer ( function() textoLoginErr = "" end, 3000, 1 )
end
addEvent("funcLoginErr", true)
addEventHandler("funcLoginErr", root, funcLoginErr)

function funcRegErr(username, password)
	textoRegErr = "La cuenta ya existe"
	setTimer ( function() textoRegErr = "" end, 3000, 1 )
end
addEvent("funcRegErr", true)
addEventHandler("funcRegErr", root, funcRegErr)

function funcNoUserNoPassword(username, password)
	textoNoUserNoPassword = "Ingresa tu usuario y contraseña"
	setTimer ( function() textoNoUserNoPassword = "" end, 3000, 1 )
end
addEvent("funcNoUserNoPassword", true)
addEventHandler("funcNoUserNoPassword", root, funcNoUserNoPassword)

function funcRegSuccess(username, password)
	textoRegSucess = "Registro exitoso, inicia sesion"
	setTimer ( function() textoRegSucess = "" end, 2000, 1 )
end
addEvent("funcRegSuccess", true)
addEventHandler("funcRegSuccess", root, funcRegSuccess)
 

 

Link to comment

Es porque el evento donde se dibujan los mensajes de error es global, osea, un clientRender que no para de ejecutarse y le saldrá a todos. Triggealo al entrar al servidor, algo así:

-- Server-side

addEventHandler( "onPlayerJoin", root,
	function( )
		triggerClientEvent( source, "dibujarMensajesDeError", source )
	end
)

-- Client-side

function mensajesError( )
	loginSucess = dxDrawText(textoLogin, (426/1024)*sWidth, (328/768)*sHeight, (732/1024)*sWidth , (258/768)*sHeight , tocolor(255, 255, 255, 255), (sWidth/1024)*1.5, "default", "left", "top", false, false, true, false, false)
    loginIncorrect = dxDrawText(textoLoginErr, (369/1024)*sWidth, (328/768)*sHeight, (732/1024)*sWidth , (258/768)*sHeight , tocolor(255, 255, 255, 255), (sWidth/1024)*1.5, "default", "left", "top", false, false, true, false, false)
	registroSuccess = dxDrawText(textoRegSucess, (378/1024)*sWidth, (328/768)*sHeight, (732/1024)*sWidth , (258/768)*sHeight , tocolor(255, 255, 255, 255), (sWidth/1024)*1.5, "default", "left", "top", false, false, true, false, false)
	registroErr = dxDrawText(textoRegErr, (418/1024)*sWidth, (328/768)*sHeight, (732/1024)*sWidth , (258/768)*sHeight , tocolor(255, 255, 255, 255), (sWidth/1024)*1.5, "default", "left", "top", false, false, true, false, false)
	NoUserNoPw = dxDrawText(textoNoUserNoPassword, (371/1024)*sWidth, (328/768)*sHeight, (732/1024)*sWidth , (258/768)*sHeight , tocolor(255, 255, 255, 255), (sWidth/1024)*1.5, "default", "left", "top", false, false, true, false, false)	
end	
function drawThis( )
	addEventHandler( "onClientRender", root, mensajesError )
end
addEvent( "dibujarMensajesDeError", true )
addEventHandler( "dibujarMensajesDeError", getRootElement( ), drawThis )

 

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...