Arsilex Posted February 8, 2014 Share Posted February 8, 2014 Bueno estoy intentando hacer un scoreboard... y con lo que tengo un problema es con los jugadores que salgan (ya que si sobre pasa el panel pues quedaría feo..) Lo que tengo es al iniciar el script los jugadores que hay en el servidor cargan en el tab tambien cargan al entrar y se sacan al salir etc etc etc.. hasta alli bien ahora el problema es que si hay mas de 14 jugadores se me sale del panel la lista... hize para limitar eso que solo salgan 14 jugadores pero tengo un problema como hacer que al usar la rueda del raton abajo del scoreboard salga el siguente jugador en esa tabla osea el 15 y se esconda el jugador 1 y si usas la rueda alreves que aga la misma funcion pero alreves osea se esconde el 15 y se aparece el 1 alguna idea?... Link to comment
Alexs Posted February 8, 2014 Share Posted February 8, 2014 Cuando era mas o menos nuevo hice un script para reemplazar el chat, al final no me gusto el resultado y lo deje en una carpeta de recursos 'rechazados', quizá esto te de una idea, fíjate en los bind de al final: local cChats = { [1] = { "", tocolor( 240, 240, 240, 255 )}, [2] = { "", tocolor( 240, 240, 240, 255 )}, [3] = { "", tocolor( 240, 240, 240, 255 )}, [4] = { "", tocolor( 240, 240, 240, 255 )}, [5] = { "", tocolor( 240, 240, 240, 255 )}, [6] = { "", tocolor( 240, 240, 240, 255 )}, [7] = { "", tocolor( 240, 240, 240, 255 )}, [8] = { "", tocolor( 240, 240, 240, 255 )}, [9] = { "", tocolor( 240, 240, 240, 255 )}, [10] = { "", tocolor( 240, 240, 240, 255 )}, [11] = { "", tocolor( 240, 240, 240, 255 )}, [12] = { "", tocolor( 240, 240, 240, 255 )}, [13] = { "", tocolor( 240, 240, 240, 255 )}, [14] = { "", tocolor( 240, 240, 240, 255 )}, [15] = { "", tocolor( 240, 240, 240, 255 )}, [16] = { "", tocolor( 240, 240, 240, 255 )}, [17] = { "", tocolor( 240, 240, 240, 255 )}, [18] = { "", tocolor( 240, 240, 240, 255 )}, [19] = { "", tocolor( 240, 240, 240, 255 )}, [20] = { "", tocolor( 240, 240, 240, 255 )}, [21] = { "", tocolor( 240, 240, 240, 255 )}, [22] = { "", tocolor( 240, 240, 240, 255 )}, [23] = { "", tocolor( 240, 240, 240, 255 )}, [24] = { "", tocolor( 240, 240, 240, 255 )}, [25] = { "", tocolor( 240, 240, 240, 255 )}, [26] = { "", tocolor( 240, 240, 240, 255 )}, [27] = { "", tocolor( 240, 240, 240, 255 )}, [28] = { "", tocolor( 240, 240, 240, 255 )}, [29] = { "", tocolor( 240, 240, 240, 255 )}, [30] = { "", tocolor( 240, 240, 240, 255 )}, [31] = { "", tocolor( 240, 240, 240, 255 )}, [32] = { "", tocolor( 240, 240, 240, 255 )}, [33] = { "", tocolor( 240, 240, 240, 255 )}, [34] = { "", tocolor( 240, 240, 240, 255 )}, [35] = { "", tocolor( 240, 240, 240, 255 )}, [36] = { "", tocolor( 240, 240, 240, 255 )} } --Tabla de mensajes inocuos anti errores. local dxFont = dxCreateFont( "comic.ttf", 10, true ) local messageEdit = guiCreateEdit(0.0025, 0.248, 0.37, 0.03, "", true) guiSetVisible( messageEdit, false ) local visible = false local chatType = 0 bindKey( "t", "down", function() if not visible then guiSetVisible( messageEdit, true ) showCursor( true ) guiEditSetCaretIndex ( messageEdit, #guiGetText( messageEdit ) ) visible = true setTimer( guiSetText, 50, 1, messageEdit, "" ) elseif visible then guiSetVisible( messageEdit, false ) showCursor( false ) visible = false end end ) bindKey( "enter", "down", function() if guiGetVisible( messageEdit ) then local text = guiGetText( messageEdit ) if #text > 0 then if text:sub( 1, 1 ) ~= "/" then triggerServerEvent( "onMessageSendRequest", localPlayer, getPlayerName( localPlayer )..": "..guiGetText( messageEdit ), 250, 240, 230, root ) guiSetVisible( messageEdit, false ) showCursor( false ) visible = false elseif text:sub( 1, 1 ) == "/" then local processtext = text:gsub( "/", "", 1 ) local command = gettok( processtext, 1, 32 ) local args = table.concat(split(processtext:gsub( command, "" ) ), " " ) if args then if not executeCommandHandler( command, args ) then triggerServerEvent( "onCommandSendRequest", localPlayer, localPlayer, command, args ) end elseif not args then if not executeCommandHandler( command ) then triggerServerEvent( "onCommandSendRequest", localPlayer, localPlayer, command ) end end end end end end ) local cache = 1 addEventHandler( "onClientChatMessage", root, function ( message, r, g, b ) table.insert( cChats, 1, { message, tocolor( r, g, b, 255 ) } ) cChats[#cChats] = nil end ) addEventHandler( "onClientResourceStart", root, function () showChat( false ) end ) addEventHandler("onClientRender", root, function() dxDrawImage(3, 1, 381, 190, "background.png", 0, 0, 0, tocolor(0, 0, 0, 140), true) local pos = 0 for i = cache, cache + 8 do dxDrawText( cChats[i][1], 5, 160 + pos, 380, 185, cChats[i][2], 1, dxFont, "left", "top", true, false, false, true, false) pos = pos - 15 end end ) bindKey( "mouse_wheel_down", "down", function () cache = math.max( cache - 1, 1 ) end ) bindKey( "mouse_wheel_up", "down", function () cache = math.min( cache + 1, 28 ) end ) Link to comment
Arsilex Posted February 8, 2014 Author Share Posted February 8, 2014 Gracias, me sirvió bastante Link to comment
Recommended Posts