Arsilex Posted May 2, 2012 Share Posted May 2, 2012 Hola miren ize este script y me sale el cuadro y todo eso pero no me sale el nombre del jugador que sali y que entra local screenWidth, screenHeight = guiGetScreenSize() alpha=0 alpha2=0 Maximo=8 Maximo2=12.75 addEventHandler("onClientPlayerJoin",getRootElement(), function (joinquit) Join = getPlayerName ( source ) .." se a unido al servidor." setTimer (stopDrawing, 11700, 1) setTimer (deleteAlpha, 11300, 1) setTimer (startDrawing, 5000, 1) end ) addEventHandler('onClientPlayerQuit', root, function ( ) Quit = getPlayerName ( source ) .." se fue del servidor." setTimer (stopDrawing, 11700, 1) setTimer (deleteAlpha, 11300, 1) setTimer (startDrawing, 5000, 1) end ) function stopDrawing () removeEventHandler ( "onClientRender", root, mainDrawing) end function startDrawing () addEventHandler ( "onClientRender", root, mainDrawing) setTimer (MovingShit, 50, Maximo) setTimer (MovingShit2, 50, Maximo2) end function MovingShit() alpha = alpha+20 end function MovingShit2() alpha2 = alpha2+20 end function deleteAlpha () setTimer (MovingShit3, 50, Maximo) setTimer (MovingShit4, 50, Maximo2) end function MovingShit3() alpha = alpha-20 end function MovingShit4() alpha2 = alpha2-20 end function mainDrawing () dxDrawImage (screenWidth/2 - 240, screenHeight - 200, 480, 175, "bg.png", 0, 0, 0, tocolor (0,0,0,alpha2)) dxDrawRectangle (screenWidth/2 - 224, screenHeight - 189, 448, 151.6, tocolor (170, 14, 162, alpha)) dxDrawText ("\n"..name, screenWidth/2 - 225, screenHeight - 190, screenWidth/2 + 224, screenHeight + 189, tocolor (255, 255, 255, alpha2), 1.5, "default-bold", "center", "top", true, false, false) dxDrawText ("\n"..name, screenWidth/2 - 224, screenHeight - 189, screenWidth/2 + 224, screenHeight + 189, tocolor (0, 0, 0, alpha2), 1.5, "default-bold", "center", "top", true, false, false) dxDrawText ("\n\n\n\n[Join]: ", screenWidth/2 - 225, screenHeight - 190, screenWidth/2, screenHeight + 189, tocolor (255, 255, 255, alpha2), 1.5, "default-bold", "right", "top", true, false, false) dxDrawText ("\n\n\n\n\n[Quit]: ", screenWidth/2 - 225, screenHeight - 190, screenWidth/2, screenHeight + 189, tocolor (255, 255, 255, alpha2), 1.5, "default-bold", "right", "top", true, false, false) dxDrawText ("\n\n\n\n[Join]: ", screenWidth/2 - 224, screenHeight - 189, screenWidth/2, screenHeight + 189, tocolor (0, 0, 0, alpha2), 1.5, "default-bold", "right", "top", true, false, false) dxDrawText ("\n\n\n\n\n[Quit]: ", screenWidth/2 - 224, screenHeight - 189, screenWidth/2, screenHeight + 189, tocolor (0, 0, 0, alpha2), 1.5, "default-bold", "right", "top", true, false, false) dxDrawText ("\n\n\n\n "..Join, screenWidth/2 - 1, screenHeight - 190, screenWidth/2 + 224, screenHeight + 189, tocolor (0, 0, 0, alpha2), 1.5, "default-bold", "left", "top", true, false, false) dxDrawText ("\n\n\n\n\n "..Quit, screenWidth/2 - 1, screenHeight - 190, screenWidth/2 + 224, screenHeight + 189, tocolor (0, 0, 0, alpha2), 1.5, "default-bold", "left", "top", true, false, false) dxDrawText ("\n\n\n\n "..Join, screenWidth/2, screenHeight - 189, screenWidth/2 + 224, screenHeight + 189, tocolor (255, 255, 255, alpha2), 1.5, "default-bold", "left", "top", true, false, false) dxDrawText ("\n\n\n\n\n "..Quit, screenWidth/2, screenHeight - 189, screenWidth/2 + 224, screenHeight + 189, tocolor (255, 255, 255, alpha2), 1.5, "default-bold", "left", "top", true, false, false) end Alguen me puede decir en que falla? Link to comment
iFoReX Posted May 2, 2012 Share Posted May 2, 2012 Pekio hace un tiempo ise uno algo parecido function dxDrawColorText(str, ax, ay, bx, by, color, scale, font, left, top, clip, wordbreak, postGUI) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if cap == "" and col then color = tocolor( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText( cap, ax, ay, ax + w, by, color, scale, font ) ax = ax + w color = tocolor( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) end last = e + 1 s, e, cap, col = str:find( pat, last ) end if last <= #str then cap = str:sub( last ) local w = dxGetTextWidth( cap, scale, font ) dxDrawText( cap, ax, ay, ax + w, by, color, scale, font, left, top, clip, wordbreak, postGUI ) end end local messageJoin = "" local messageQuit = "" function renderPlayerJoined ( ) dxDrawColorText("* ".. messageJoin,504.0,4.0,574.0,20.0,tocolor(200,0,0,255),0.7,"sans","left","top",false,false,false) end function renderPlayerLeft ( ) dxDrawColorText("* ".. messageQuit,503.0,16.0,573.0,32.0,tocolor(0,0,255,170),0.7,"sans","left","top",false,false,false) end addEventHandler('onClientPlayerJoin', root, function() messageJoin = getPlayerName(source) .. " #ffffffa entrado al servidor." addEventHandler ( "onClientRender", root, renderPlayerJoined ) setTimer ( function ( ) removeEventHandler ( "onClientRender", root, renderPlayerJoined ) end ,6000,1 ) end ) addEventHandler('onClientPlayerChangeNick', root, function(oldNick, newNick) outputChatBox('* ' .. oldNick .. ' #ffffffis now known as ' .. newNick, 255, 100, 100) end ) addEventHandler('onClientPlayerQuit', root, function(reason) messageQuit = getPlayerName(source) .. " #ffffffa salido del server [" .. reason .. "]" addEventHandler ( "onClientRender", root, renderPlayerLeft ) setTimer ( function ( ) removeEventHandler ( "onClientRender", root, renderPlayerLeft ) end ,6000,1 ) end ) ai investiga mi codigo espero averte ayudado Link to comment
Arsilex Posted May 3, 2012 Author Share Posted May 3, 2012 vale muchas gracias voy a mirar aver si saco algo Link to comment
yaver123 Posted May 3, 2012 Share Posted May 3, 2012 function dxDrawColorText(str, ax, ay, bx, by, color, scale, font, left, top, clip, wordbreak, postGUI) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if cap == "" and col then color = tocolor( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText( cap, ax, ay, ax + w, by, color, scale, font ) ax = ax + w color = tocolor( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) end last = e + 1 s, e, cap, col = str:find( pat, last ) end if last <= #str then cap = str:sub( last ) local w = dxGetTextWidth( cap, scale, font ) dxDrawText( cap, ax, ay, ax + w, by, color, scale, font, left, top, clip, wordbreak, postGUI ) end end local messageJoin = "" local messageQuit = "" function renderPlayerJoined ( ) dxDrawColorText("* ".. messageJoin,504.0,4.0,574.0,20.0,tocolor(200,0,0,255),0.7,"sans","left","top",false,false,false) end function renderPlayerLeft ( ) dxDrawColorText("* ".. messageQuit,503.0,16.0,573.0,32.0,tocolor(0,0,255,170),0.7,"sans","left","top",false,false,false) end addEventHandler('onClientPlayerJoin', root, function() messageJoin = getPlayerName(source) .. " #ffffffa entrado al servidor." addEventHandler ( "onClientRender", root, renderPlayerJoined ) setTimer ( function ( ) removeEventHandler ( "onClientRender", root, renderPlayerJoined ) end ,6000,1 ) end ) addEventHandler('onClientPlayerChangeNick', root, function(oldNick, newNick) outputChatBox('* ' .. oldNick .. ' #ffffffis now known as ' .. newNick, 255, 100, 100) end ) addEventHandler('onClientPlayerQuit', root, function(reason) messageQuit = getPlayerName(source) .. " #ffffffa salido del server [" .. reason .. "]" addEventHandler ( "onClientRender", root, renderPlayerLeft ) setTimer ( function ( ) removeEventHandler ( "onClientRender", root, renderPlayerLeft ) end ,6000,1 ) end ) Elmota en que parte pongo para cambiarla de lugar? osea que en ves que este arriba que este a la derecha Link to comment
Recommended Posts