Saltar al contenido
  • Global

    Global

    Chatroom Rules

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

Publicaciones recomendadas

  • Ex-Staff
Publicado (editado)

Buenas comunidad, hoy les vengo con un aporte.

Un script sencillo, pero que puede ser útil a la hora de darle estilo a tu servidor ya sea de stealth, tdm o cualquier cosa que tenga un equipos y compitan por algún puntaje...

 

 

 

function dxDrawEmptyRec(startX,startY,endX,endY,color,width,postGUI)
	dxDrawLine(startX,startY,startX+endX,startY,color,width,postGUI)
	dxDrawLine(startX,startY,startX,startY+endY,color,width,postGUI)
	dxDrawLine(startX,startY+endY,startX+endX,startY+endY, color,width,postGUI)
	dxDrawLine(startX+endX,startY,startX+endX,startY+endY,color,width,postGUI)
end

dxScore = {
	x = 10,
	y = 400,
	xGap = 10,
	yGap = 5,
	height = 15,
	width = 40,
	teamWidth = 0,
	blockHeight = 0,
	blockWidth = 0,
}

lineas={255,255,255,150}

team_data= 'Score' -- Nombre del data
data_title= 'Puntaje' -- Titulo para representar 'team_data'

function dxScore.draw()
local teams=getElementsByType('team')
	if #teams > 1 then
		dxDrawRectangle(dxScore.x,
						dxScore.y,
						dxScore.blockWidth,
						dxScore.blockHeight,
						tocolor(0,0,0,100),false)
		dxDrawEmptyRec(dxScore.x,
						dxScore.y,
						dxScore.blockWidth,
						dxScore.blockHeight,
						tocolor(lineas[1],lineas[2],lineas[3],lineas[4]),1,false)		
		dxDrawLine(dxScore.x + dxScore.xGap + dxScore.teamWidth + (dxScore.xGap/2),
					dxScore.y + (dxScore.yGap/2),
					dxScore.x + dxScore.xGap + dxScore.teamWidth + (dxScore.xGap/2),
					dxScore.y + dxScore.blockHeight - (dxScore.yGap/2),
					tocolor(lineas[1],lineas[2],lineas[3],lineas[4]),1,false)
			
		dxDrawLine(dxScore.x + dxScore.xGap + dxScore.teamWidth + (dxScore.xGap/2),
					dxScore.y + dxScore.blockHeight - (dxScore.yGap/2),
					dxScore.x + dxScore.xGap + dxScore.teamWidth + (dxScore.xGap/2),
					dxScore.y + dxScore.blockHeight - (dxScore.yGap/2),
					tocolor(lineas[1],lineas[2],lineas[3],lineas[4]),1,false)
					
		dxDrawText("Equipo",dxScore.x+ (dxScore.xGap),
							dxScore.y + dxScore.yGap,
							dxScore.x + (dxScore.xGap*2) + dxScore.teamWidth + dxScore.width,
							dxScore.y + dxScore.height + dxScore.yGap,
							tocolor(255,255,255,255),1,"default","left","center",false,false,false)	
		
		dxDrawText(data_title,dxScore.x + (dxScore.xGap*2) + dxScore.teamWidth,		
							  dxScore.y + dxScore.yGap,
							  dxScore.x + (dxScore.xGap*2) + dxScore.teamWidth + dxScore.width,
							  dxScore.y + dxScore.height + dxScore.yGap,
							  tocolor(255,255,255,255),1,"default","left","center",false,false,false)							
				
		for i,team in ipairs(teams) do			
					
					dxDrawLine(dxScore.x + (dxScore.xGap/2),
							dxScore.y + (i*dxScore.height) + (i*dxScore.yGap),
							dxScore.x + dxScore.blockWidth - (dxScore.xGap/2),
							dxScore.y + (i*dxScore.height) + (i*dxScore.yGap),
							tocolor(lineas[1],lineas[2],lineas[3],lineas[4]),1,false )
					
					
					local nombre = getTeamName(team)
					local team_r,team_g,team_b = getTeamColor(team)
					

					dxDrawText(nombre,
							dxScore.x + dxScore.xGap,
							dxScore.y + (i*dxScore.height) + (i*dxScore.yGap) + (dxScore.yGap/2),
							dxScore.x + dxScore.xGap + dxScore.teamWidth,
							dxScore.y + (i*dxScore.height) + (i*dxScore.yGap) + (dxScore.yGap/2) + dxScore.height,
							tocolor(team_r,team_g,team_b,255),1,"default-bold","center","center",false,false,false,true)
								
					dxDrawText(tostring(getElementData(team,team_data) or 0),
								dxScore.x + (dxScore.xGap*2) + dxScore.teamWidth,
								dxScore.y + (i*dxScore.height) + (i*dxScore.yGap) + (dxScore.yGap/2),
								dxScore.x + (dxScore.xGap*2) + dxScore.teamWidth + dxScore.width,
								dxScore.y + (i*dxScore.height) + (i*dxScore.yGap) + (dxScore.yGap/2) + dxScore.height,
								tocolor(255,255,255,255),1,"default-bold","center","center",false,false,false)																
			end		
		dxScore.dimensions()
	end	
end
addEventHandler("onClientRender",root,dxScore.draw)	
function dxScore.dimensions()
local teams=getElementsByType('team')
	dxScore.teamWidth = 0
	
	for i,team in ipairs(teams) do
		local len = dxGetTextWidth(getTeamName(team),1,"default-bold")					
		
		if len > dxScore.teamWidth then
			dxScore.teamWidth = len
		end
	end
	
	dxScore.blockHeight = (#teams * (dxScore.height + dxScore.yGap)) + (dxScore.yGap*2) + dxScore.height
	dxScore.blockWidth = dxScore.teamWidth+(dxScore.xGap*2) + (1 and dxScore.width or 0) + dxScore.xGap + (1 and dxScore.width + dxScore.xGap or 0)

	dxScore.x = sx - dxScore.blockWidth - 10
	dxScore.y = sy - dxScore.blockHeight - 15
end
 

 

 

 

Imagen de ejemplo

351thtd.png

Editado por SAXI
  • 9 months later...

Join the conversation

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

Invitado
Responder a este tema...

×   Pegar como texto enriquecido.   Pegar como texto sin formato

  Only 75 emoji are allowed.

×   Tu enlace se ha incrustado automáticamente..   Mostrar como un enlace en su lugar

×   Se ha restaurado el contenido anterior.   Limpiar editor

×   No se pueden pegar imágenes directamente. Carga o inserta imágenes desde la URL.

  • Explorando recientemente   0 miembros

    • No hay usuarios registrados viendo esta página.
×
×
  • Crear nuevo...