Jump to content

[dxScoreboard] Drawing images.


WolfPire

Recommended Posts

Posted

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.

Posted
Do you have a resource called flags?

Not really, the flags are all in a resource called "ENLLoc"

Inside that folder there's a folder called "flags" where the flags are allocated.

Posted (edited)

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

Posted
ok, copy the code again

Noticed you added an "outputChatBox", works perfectly...

Still the same error... My flag is not in the folder as i'm Venezuelan, but it should atleast show "N/A" but neh...

Posted

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 

Posted (edited)
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
Posted
I'm not sure what to say...

ok, try lower-casing the resource name,

actually, post screenshots of you going to the folder with the flags please

Is there anyway to add all the flags to meta? (I got most, but new flags were added and idk which) Without having to copy one by one?

Posted
well, you could make a system, but it's just going to be a waste of time

other than that, no

It should be working now then... Thanks for the help man :) I really appreciate it!

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