Jump to content
  • Global

    Global

    Chatroom Rules

    • NO SE DA SOPORTE EN CHATBOX
    • NO SPAM
    • NO FLOOD

Recommended Posts

  • Ex-Staff
Posted

Hola, buenas.

Hoy traigo para los programadores de MTA unas cuantas funciones útiles para su desarrollo en el cliente... ¿A qué voy?

Simple, se trata de la creación de un texto (dxDrawText) con el texto editable.

 

Esto les servirá de mucha ayuda, para quienes quieren crear su propia 'dxLib' les dará un incapie para la creación de el famosisimo

'dxEdit'

 

Sin más vueltas les dejo el código.

 

 

 

textos={}
function dxCreateEditText(texto,posX,posY,ancho,alto,color)
local new={}
	new.Texto,new.PosX,new.PosY,new.Ancho,new.Alto,new.Color=texto,posX,posY,ancho,alto,color
	textos[#textos+1] = new
	return textos[#textos+1]
end
function drawTexts()
	for k,v in pairs(textos) do
		dxDrawText(v.Texto,v.PosX,v.PosY,v.Ancho,v.Alto,v.Color)
	end	
end
addEventHandler("onClientPreRender",root,drawTexts)

function escribirEnTexto(texto,estado)
	if estado then
		txt=texto
		addEventHandler("onClientCharacter",root,charText)
	else
		removeEventHandler("onClientCharacter",root,charText)
	end	
end	
function charText(key)
	textos[txt].Texto=textos[txt].Texto..key
end

function destruirTexto(texto)
	if type(texto) == "number" then
		textos[texto] = nil
		return true
	end	
return false
end
 

 

 

 

Responderé todas las dudas al respecto...

Si hay algún problema con el código hacerme informar.

 

Saludos.

  • Ex-Staff
Posted

Muy buen aporte para la gente que esta empezando en el mundo del scripting en mta (como yo). Voy a probar el codigo haber que tal, un saludo

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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