Jump to content

DxDraw por orden en tabla


aka Blue

Recommended Posts

Posted

Bueno, estoy desde el movil y no se si me daré a entender, pero, quiero hacer una especie de script de notificaciones dx. Que aparezca una y encima otra y se eliminen, segun el orden en la tabla, algo asi :S

local pendientes = {}

addEventHandler( "onClientRender", root,
  function()
    dxDrawText(pendientes[textoEnOrden])
  end
) 

No se como explicarlo correctamente, lo siento xD

Gracias de antemano

Posted
On 31/10/2016 at 4:11 PM, aka Blue said:

Bueno, estoy desde el movil y no se si me daré a entender, pero, quiero hacer una especie de script de notificaciones dx. Que aparezca una y encima otra y se eliminen, segun el orden en la tabla, algo asi :S


local pendientes = {}

addEventHandler( "onClientRender", root,
  function()
    dxDrawText(pendientes[textoEnOrden])
  end
) 

No se como explicarlo correctamente, lo siento xD

Gracias de antemano

Explicate bien.

 

Posted

Básicamente quiero hacer un sistema de notificaciones, que cuando se utilice un trigger hacia el cliente (hacia el script de notificaciones en cuestión), se meta el texto en una tabla, y el render, vaya renderizando los textos de la tabla y eliminándolos según los renderice.

Posted

Si, pero lo que pasa es que quiero que el texto se mantenga unos segundos y desaparezca con una animación de interpolateBetween, que es lo que me cuesta entender bien xd.

Posted

Donde metes el mensaje colocas el tiempo que quieres que el mensaje se deshaga y lo sumas con getTickCount, luego dentro del loop comparas el valor con getTickCount nuevamente y si se cumple ahí haces lo del interpolado.

Posted

@Gaberiel ¿Algo así?

local textos = { }

function insertText( text, time )
	local text = table.concat( { text }, " " )
	local time = tonumber( time )
	if text and time then
		table.insert( textos, { text = text, time = getTickCount( ) + time } )
	end
end

addEventHandler( "onClientRender", root,
	function( )
		if #textos > 0 then
			for i=1, #textos do
				local d = textos[ i ]
				local text, time = d.text, d.time
				if time < getTickCount( ) then
					table.remove( textos, i )
				else
					dxDrawText( text, sx, sy, sx, sy, ... )
				end	
			end
		end
	end
)

Me vas a disculpar con el getTickCount, nunca me aclaré en como usarlo para interpolate o para renders :S 

Posted
Just now, aka Blue said:

@Gaberiel ¿Algo así?


local textos = { }

function insertText( text, time )
	local text = table.concat( { text }, " " )
	local time = tonumber( time )
	if text and time then
		table.insert( textos, { text = text, time = getTickCount( ) + time } )
	end
end

addEventHandler( "onClientRender", root,
	function( )
		if #textos > 0 then
			for i=1, #textos do
				local d = textos[ i ]
				local text, time = d.text, d.time
				if time < getTickCount( ) then
					table.remove( textos, i )
				else
					dxDrawText( text, sx, sy, sx, sy, ... )
				end	
			end
		end
	end
)

Me vas a disculpar con el getTickCount, nunca me aclaré en como usarlo para interpolate o para renders :S 

if getTickCount( ) > time then

  • Recently Browsing   0 members

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