Jump to content

scoreboard flag img


Blaawee

Recommended Posts

hi guys i found an old scoreboard and there was this line :

elseif column.name == "countryCode" then 
                                if content ~= "N/A" then 
                                    local countryImage = "flags/"..string.lower(content)..".png" 
                                    dxDrawImage(topX+theX, y+s(1)-2, 16, 16, countryImage,0,0,0,tocolor( 255,255,255,255 ), true) 
                                end 

all i wana to do to make it work , what is the right to do

Link to comment

Hi :)

It's simple...

When you set the data in the scoreboard, the column name must be "countryCode" per example.

And it must be a number (0-9). When the player press in tab, the scoreboard go search in his files the pic "flags/(0-9).png".

Example ?

  
exports.scoreboard:addScoreboardColumn("countryCode", getRootElement(), 1, 0.2) 
-- Arguments: 1th is the column name, 2nd is getRootElement(), 3rd is the value, 4th is the size 
  

Good luck, FatalTerror

Edit: the img must be in scoreboard resource :roll:

Link to comment

add this on line 705 (maybe you need to ad somewhere els bk your scoreboard is difrent)

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

and set the flag like this notice that admin panel recognize some countryes for what he don't have flag's so you can put a check function to check if is a flag or not else if a country is whitout flag you will be spamed in debugscript whit dxDrawImage can't load file path

local flag = exports.admin:getPlayerCountry ( source ) 
if flag then 
setElementData(source,"Pic",":admin/client/images/flags/"..flag..".png") 
end 
  

Link to comment

Orange : we don't need your crap useless post's help or shut up and don't spam

----flag.lua

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

<meta> 
    <script src="flag.lua" type="server" /> 
 </meta> 

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