Jump to content

question


Kenix

Recommended Posts

i know it lol -_-

but i dont know how to transfer line

  
addEventHandler("onClientRender",root, 
    function() 
        if getElementData(me,"isLogged") then 
            dxDrawRectangle(385.0,190.0,519.0,645.0,tocolor(0,0,0,200),false) 
            dxDrawText("Name                           ID               Ping",458.0,290.0,616.0,310.0,tocolor(255,255,255,255),1.3,"arial","left","top",false,false,false) 
            for i , v in ipairs(getElementsByType('player')) do 
                dxDrawText("\n ("..i..")"..getPlayerName(v).."           "..tonumber(getElementData(v,"ID")) or 0 .."",458.0,312.0,916.0,332.0,tocolor(255,255,255,255),1.3,"arial","left","top",false,false,false) 
                dxDrawText("\n                                                     "..getPlayerPing(v),458.0,312.0,916.0,332.0,tocolor(255,255,255,255),1.3,"arial","left","top",false,false,false) 
            end 
        end  
    end 
) 
  

Link to comment

If you mean, draw every player on a new line, use this method:

addEventHandler("onClientRender", root, function() 
    local x, y = 385,190 
    local dy = 15 
    for i, player in ipairs(getElementsByType('player') do 
        dxDrawText(getPlayerName(player), x, y + dy * (i - 1)) 
    end 
end) 

Link to comment
  
local _getPlayerName = getPlayerName 
  
addEventHandler("onClientRender",root, 
    function() 
        --if getElementData(me,"isLogged") then -- You can add this, i was testing and fixing it. 
            local screenx, screeny = guiGetScreenSize() 
            local line = 0 
  
            for i , v in ipairs(getElementsByType('player')) do 
                 
                dxDrawRectangle( ((screenx/2-(600/2))/1024)*screenx, ((screeny/2-(line * 20 + 100))/768)*screeny, (600/1024)*screenx, (line * 20 + 80/768)*screeny ,tocolor(0,0,0,200),false) 
  
                dxDrawText("Name", ((screenx/2-(600/2-10))/1024)*screenx, ((screeny/2-(line * 20 + 90))/768)*screeny, ((screenx/2-(600-10/2))/1024)*screenx, ((screeny/2-(line * 20 + 90))/768)*screeny,tocolor(255,255,255,255), (screenx/800)*1.2,"arial","left","top",false,false,false) 
                dxDrawText("ID", ((screenx/2-(600/2-300))/1024)*screenx, ((screeny/2-(line * 20 + 90))/768)*screeny, ((screenx/2-(600/2-300))/1024)*screenx, ((screeny/2-(line * 20 + 90))/768)*screeny,tocolor(255,255,255,255), (screenx/800)*1.2,"arial","left","top",false,false,false) 
                dxDrawText("Ping", ((screenx/2-(600/2-550))/1024)*screenx, ((screeny/2-(line * 20 + 90))/768)*screeny, ((screenx/2-(600/2-550))/1024)*screenx, ((screeny/2-(line * 20 + 90))/768)*screeny,tocolor(255,255,255,255), (screenx/800)*1.2,"arial","left","top",false,false,false) 
                     
                dxDrawText("(" .. i .. ")" .. getPlayerName(v) , ((screenx/2-(600/2-10))/1024)*screenx, ((screeny/2-(line * 20 + 60))/768)*screeny, ((screenx/2-(600/2-10))/1024)*screenx, ((screeny/2-(line * 20 + 55))/768)*screeny,tocolor(255,255,255,200), (screenx/800)*1.2,"arial","left","top",false,false,false) 
                dxDrawText( tonumber(getElementData(v,"ID")) or 0, ((screenx/2-(600/2-300))/1024)*screenx, ((screeny/2-(line * 20 + 60))/768)*screeny, ((screenx/2-(600/2-300))/1024)*screenx, ((screeny/2-(line * 20 + 55))/768)*screeny,tocolor(255,255,255,200), (screenx/800)*1.2,"arial","left","top",false,false,false) 
                dxDrawText( getPlayerPing (v), ((screenx/2-(600/2-550))/1024)*screenx, ((screeny/2-(line * 20 + 60))/768)*screeny, ((screenx/2-(600/2-550))/1024)*screenx, ((screeny/2-(line * 20 + 55))/768)*screeny,tocolor(255,255,255,200), (screenx/800)*1.2,"arial","left","top",false,false,false) 
             
                line = line + 1 
            end 
        --end  
    end 
) 
  
function removeColorCoding ( name ) -- Credis to Race 
    return type(name)=='string' and string.gsub ( name, '#%x%x%x%x%x%x', '' ) or name 
end 
  
  
function getPlayerName ( player ) -- Credis to Race 
    return removeColorCoding ( _getPlayerName ( player ) ) 
end 
  

Edit: Maybe this is better or not, i was fixing... too slow D:

Edit2: http://imageshack.us/photo/my-images/21/helpingw.png/

Link to comment
  
local _getPlayerName = getPlayerName 
  
addEventHandler("onClientRender",root, 
    function() 
        --if getElementData(me,"isLogged") then -- You can add this, i was testing and fixing it. 
            local screenx, screeny = guiGetScreenSize() 
            local line = 0 
  
            for i , v in ipairs(getElementsByType('player')) do 
                 
                dxDrawRectangle( ((screenx/2-(600/2))/1024)*screenx, ((screeny/2-(line * 20 + 100))/768)*screeny, (600/1024)*screenx, (line * 20 + 80/768)*screeny ,tocolor(0,0,0,200),false) 
  
                dxDrawText("Name", ((screenx/2-(600/2-10))/1024)*screenx, ((screeny/2-(line * 20 + 90))/768)*screeny, ((screenx/2-(600-10/2))/1024)*screenx, ((screeny/2-(line * 20 + 90))/768)*screeny,tocolor(255,255,255,255), (screenx/800)*1.2,"arial","left","top",false,false,false) 
                dxDrawText("ID", ((screenx/2-(600/2-300))/1024)*screenx, ((screeny/2-(line * 20 + 90))/768)*screeny, ((screenx/2-(600/2-300))/1024)*screenx, ((screeny/2-(line * 20 + 90))/768)*screeny,tocolor(255,255,255,255), (screenx/800)*1.2,"arial","left","top",false,false,false) 
                dxDrawText("Ping", ((screenx/2-(600/2-550))/1024)*screenx, ((screeny/2-(line * 20 + 90))/768)*screeny, ((screenx/2-(600/2-550))/1024)*screenx, ((screeny/2-(line * 20 + 90))/768)*screeny,tocolor(255,255,255,255), (screenx/800)*1.2,"arial","left","top",false,false,false) 
                     
                dxDrawText("(" .. i .. ")" .. getPlayerName(v) , ((screenx/2-(600/2-10))/1024)*screenx, ((screeny/2-(line * 20 + 60))/768)*screeny, ((screenx/2-(600/2-10))/1024)*screenx, ((screeny/2-(line * 20 + 55))/768)*screeny,tocolor(255,255,255,200), (screenx/800)*1.2,"arial","left","top",false,false,false) 
                dxDrawText( tonumber(getElementData(v,"ID")) or 0, ((screenx/2-(600/2-300))/1024)*screenx, ((screeny/2-(line * 20 + 60))/768)*screeny, ((screenx/2-(600/2-300))/1024)*screenx, ((screeny/2-(line * 20 + 55))/768)*screeny,tocolor(255,255,255,200), (screenx/800)*1.2,"arial","left","top",false,false,false) 
                dxDrawText( getPlayerPing (v), ((screenx/2-(600/2-550))/1024)*screenx, ((screeny/2-(line * 20 + 60))/768)*screeny, ((screenx/2-(600/2-550))/1024)*screenx, ((screeny/2-(line * 20 + 55))/768)*screeny,tocolor(255,255,255,200), (screenx/800)*1.2,"arial","left","top",false,false,false) 
             
                line = line + 1 
            end 
        --end  
    end 
) 
  
function removeColorCoding ( name ) -- Credis to Race 
    return type(name)=='string' and string.gsub ( name, '#%x%x%x%x%x%x', '' ) or name 
end 
  
  
function getPlayerName ( player ) -- Credis to Race 
    return removeColorCoding ( _getPlayerName ( player ) ) 
end 
  

Edit: Maybe this is better or not, i was fixing... too slow D:

Edit2: http://imageshack.us/photo/my-images/21/helpingw.png/

Thx dude

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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