Jump to content

Scoreboard


Recommended Posts

Posted

Hello, I'm using dx scoreboard (mta sa one) and i'm trying to mix fps column and ping column in one column, and i'm asking if it's possible to mix 2 element datas into 1 column like example Image and text? Thanks in advance

  • 3 weeks later...
Posted

So i edited scoreboard for that i added those lines to the scoreboard client side script,

if content.type == "image+text" and fileExists(content.src) then 
                                    local itemHeight = content.height or dxGetFontHeight( fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont ) 
                                    local itemWidth = content.width or content.height/itemHeight * content.width 
  
                                    if itemHeight > dxGetFontHeight( fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont ) then 
                                    itemHeight = dxGetFontHeight( fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont ) 
                                    end 
  
                                    content.color = content.color or tocolor(255,255,255,255) 
                                    content.rot = content.rot or 0 
                                    content.rotOffX = content.rotOffX or 0 
                                    content.rotOffY = content.rotOffY or 0 
                                     
                                    dxDrawImage ( topX+theX, y, itemWidth, itemHeight, content.src, content.rot, content.rotOffX, content.rotOffY, content.color, drawOverGUI ) 
                                    dxDrawText( content.text, topX+theX+itemWidth+s(4)+s(1),    y+s(1),     topX+x+s(1+column.width),   y+s(11)+dxGetFontHeight( fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont ),  tocolor( 0, 0, 0, a or 255 ), fontscale(teamHeaderFont, s(1)), teamHeaderFont, "left", "top", true, false, drawOverGUI ) 
                                    dxDrawText( content.text, topX+theX+itemWidth+s(4),         y,      topX+x+s(column.width),     y+dxGetFontHeight( fontscale(teamHeaderFont, scoreboardScale), teamHeaderFont ),            tocolor( r or 255, g or 255, b or 255, a or 255 ), fontscale(teamHeaderFont, s(1)), teamHeaderFont, "left", "top", true, false, drawOverGUI ) 
                                end 

What's next?

By the way here is my code which it exports country name and image,

exports["scoreboard"]:addScoreboardColumn( "", getRootElement() , 3, 20, "") 
  
function showcountry() 
local flag = exports.admin:getPlayerCountry ( source ) 
local ip = getPlayerIP( source ) 
 if flag then 
    setElementData(source,"",":admin/client/images/flags/"..flag..".png") 
    else 
    flag = "Unknown" 
 end 
end 
addEventHandler("onPlayerJoin",getRootElement(), showcountry) 
  
exports["scoreboard"]:addScoreboardColumn( "Country", getRootElement() , 4, 120, "Country") 
  
addEventHandler("onPlayerJoin", getRootElement(), 
function() 
    local country = exports['admin']:getPlayerCountry(source) 
    local ip = getPlayerIP( source ) 
    if country then 
        local thecountry = countryNames[country] 
        setElementData(source, "Country", thecountry) 
    else 
        country = "Unknown" 
   end 
end) 

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...