Jump to content

[dxScoreboard] Drawing images.


WolfPire

Recommended Posts

So i want to make my own sytstem of flags... Showing the image of where the player lives...

I'm just 1 step to do this... But there's a problem...

Here's the 2 codes:

loc_s.lua (Server)

exports.scoreboard:addScoreboardColumn('Location') 
  
function addLoc() 
    local Loc = exports.admin:getPlayerCountry ( source ) 
    if Loc then 
    setElementData(source,"Location",":flags/"..Loc..".png", true) 
    else 
    setElementData(source,"Location","N/A", true) 
    end 
end 
  
addEventHandler("onPlayerJoin",root, addLoc) 

Edit in Line 705 on dxScoreboard_client (Client)

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

So here's the problem....

Whenever i start the scripts... Flags won't show... Just a blank space and there's an error that says:

"ERROR: scoreboard/dxscoreboard_client.lua:705: dxDrawImage can't load file"

And i don't know whether the error lay's into my script or the dxScoreboard...

Help would be appreciated.

Thanks in advance.

Link to comment

ok, try this:

exports.scoreboard:addScoreboardColumn('Location') 
  
function addLoc() 
    local Loc = exports.admin:getPlayerCountry ( source ) 
    if Loc then 
    outputChatBox(Loc) 
    setElementData(source,"Location",":ENLLoc/flags/"..string.lower(Loc)..".png", true) 
    else 
    setElementData(source,"Location","N/A", true) 
    end 
end 
  
addEventHandler("onPlayerJoin",root, addLoc) 

Edited by Guest
Link to comment
ok, try this:
exports.scoreboard:addScoreboardColumn('Location') 
  
function addLoc() 
    local Loc = exports.admin:getPlayerCountry ( source ) 
    if Loc then 
    setElementData(source,"Location",":ENLLoc/flags/"..Loc..".png", true) 
    else 
    setElementData(source,"Location","N/A", true) 
    end 
end 
  
addEventHandler("onPlayerJoin",root, addLoc) 

Same error outputs....

I'm guessing the export is returning an uppercase code? Because the flags are lowercase'd.

Dunno if that'll interfere in anyway...

Link to comment

ok, and for the dxscoreboard, try this:

                                elseif column.name == "Location" then 
                                    if not dxDrawImage( topX+theX, y+s(1), 16, 11, content, 0, 0, 0, cWhite, drawOverGUI ) then 
                                         dxDrawText(content,topX+theX, y+s(1), 16, 11,cWhite,1,"default","left","top",false,false,drawOverGUI) 
                                    end 
                                else 

Link to comment
ok, and for the dxscoreboard, try this:
                                elseif column.name == "Location" then 
                                    if not dxDrawImage( topX+theX, y+s(1), 16, 11, content, 0, 0, 0, cWhite, drawOverGUI ) then 
                                         dxDrawText(content,topX+theX, y+s(1), 16, 11,cWhite,1,"default","left","top",false,false,drawOverGUI) 
                                    end 
                                else 

The error still persists... I added more flags, including my country's one...

So here... This is what it looks like now Dx I'm still thinking it's because of the upper-case/lower-case problem~

pichm.jpg

EDIT: Wait what? A player entered the server and worked for him/her ? o_o

EDIT2: Silly me forgot to add to meta...

Edited by Guest
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...