Jump to content

Nombre del jugador en F1


Lalalu

Recommended Posts

Posted

Hola, cómo les va.. quisiera saber como puedo hacer para que en lugar de decir "Player" en la línea número 8, salga el nombre del jugador sin colores ni nada, sólo el nombre del jugador en color blanco, espero sus respuestas:???::

wndMain = {
	'wnd',
	text='Freroasjsadnm',
	x = 10,
	y = 210,
	width = 287,
	controls = {
		{'lbl', text='Player', width=100},
		{'br'},

 

Posted (edited)

Reemplazalo.

{'lbl', text='Player', id="pname", width=100},

 

Y luego añades esto:

addEventHandler("onClientPlayerChangeNick", localPlayer, 
	function(_,nN) 
    	guiSetText(getControl("pname"), getPlayerName(localPlayer):gsub("#%x%x%x%x%x%x", ""))
  	end
)

 

Edited by Gaberiel
sintaxis...
Posted
wndMain = {
	'wnd',
	text='Freroasjsadnm',
	x = 10,
	y = 210,
	width = 287,
	controls = {
		{'lbl', id= "nombre"},
		{'br'},

--------------------

--Agregas esta función
function RemoveHEXColorCode( s ) 
    return s:gsub( '#%x%x%x%x%x%x', '' ) or s 
end 

--Buscas esta función y agrega esa línea
function toggleFRWindow()
	if isWindowOpen(wndMain) then
		showCursor(false)
		hideAllWindows()
		colorPicker.closeSelect()
	else
		showCursor(true)
		showAllWindows()
		setControlText(wndMain, 'nombre', RemoveHEXColorCode(getPlayerName(localPlayer)))	
	end
end

 

Posted

Así?

wndMain = {
	'wnd',
	text='sadasd',
	x = 10,
	y = 210,
	width = 287,
	controls = {
		{'lbl', id= "nombre"},
		{'br'},

function RemoveHEXColorCode( s ) 
    return s:gsub( '#%x%x%x%x%x%x', '' ) or s 
end 

function toggleFRWindow()
	if isWindowOpen(wndMain) then
		showCursor(false)
		hideAllWindows()
		colorPicker.closeSelect()
	else
		showCursor(true)
		showAllWindows()
		setControlText(wndMain, 'nombre', RemoveHEXColorCode(getPlayerName(localPlayer)))	
	end
end

 

Posted
17 minutes ago, Lalalu said:

Así?


wndMain = {
	'wnd',
	text='sadasd',
	x = 10,
	y = 210,
	width = 287,
	controls = {
		{'lbl', id= "nombre"},
		{'br'},

function RemoveHEXColorCode( s ) 
    return s:gsub( '#%x%x%x%x%x%x', '' ) or s 
end 

function toggleFRWindow()
	if isWindowOpen(wndMain) then
		showCursor(false)
		hideAllWindows()
		colorPicker.closeSelect()
	else
		showCursor(true)
		showAllWindows()
		setControlText(wndMain, 'nombre', RemoveHEXColorCode(getPlayerName(localPlayer)))	
	end
end

 

Posted (edited)

Yo lo probé y funciona, sino postea la línea que marca el error, y te ayudaré

Y no es Gabriel, aunque suena por poco así :b

Edited by Slash14
  • Recently Browsing   0 members

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