Jump to content

Exporting flag and country name in scoreboard


King12

Recommended Posts

Hello, I managed to export flag but I couldn't export country name in the same column. How can I do it?

-- Script code
exports.scoreboard:addScoreboardColumn('Country') 
      
function showcountry()
  local flag = exports.admin:getPlayerCountry ( source ) 
    if flag then 
      setElementData(source,"Country",":admin/client/images/flags/"..flag..".png") 
    else 
      flag = "N/A" 
   end 
end
addEventHandler("onPlayerJoin",getRootElement(),showcountry) 

-- Scoreboard code
elseif column.name == "Country" then 
  dxDrawImage( topX+theX, y+s(1), 16, 11, content, 0, 0, 0, cWhite, drawOverGUI ) 

 

Link to comment

Try this maybe. Flag files have lower letter names and admin panel shows big letters for countrycodes. Also just to be sure, forced the 'flag' to be a string.

-- Script code
exports.scoreboard:addScoreboardColumn('Country') 
      
function showcountry()
  local flag = exports.admin:getPlayerCountry ( source ) 
    if flag then 
      setElementData(source,"Country",":admin/client/images/flags/"..string.lower(tostring(flag))..".png") 
    else 
      flag = "N/A" 
   end 
end
addEventHandler("onPlayerJoin",getRootElement(),showcountry) 

-- Scoreboard code
elseif column.name == "Country" then 
  dxDrawImage( topX+theX, y+s(1), 16, 11, content, 0, 0, 0, cWhite, drawOverGUI ) 

Or have a look at how it's done in my scoreboard.zip here: http://www.mediafire.com/file/bk1ipa4vhq1swal/scoreboard.zip

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