Jump to content

Rank emblem


-Doc-

Recommended Posts

I wanted to display rank emblems in scoreboard but it won't.

exports.scoreboard:addScoreboardColumn('Rank') 
  
function scoreLevel () 
    local account = getPlayerAccount(source) 
    local level = getElementData(source, "player.level") 
    if isGuestAccount(account) then 
        setElementData(source, "emblem.system", "ranks/guest.png") --Show the image for guest players 
    else 
        setElementData(source, "emblems.system", tostring("Rank_"..level..".png" )) --Show the images rank 
    end 
end 
addEventHandler("onPlayerJoin", getRootElement(), scoreLevel) 
addEventHandler("onPlayerLogin", getRootElement(), scoreLevel) 

Link to comment

Images in scoreboard are defined in element data in the format of a table, such as the following (applies only to default scoreboard resource)

{ 
    ["type"] = "image", 
    ["src"] = ":resource/file.ext", -- must include ':resource' part as the scoreboard resource will otherwise look within its own directory for the image (afaik). 
    ["color"] = tocolor(255,255,255,255), 
    ["width"] = 20, 
    ["height"] = 20, 
} 
  
-- Code adapted from 'voice' resource. 

Edited by Guest
Link to comment
exports.scoreboard:addScoreboardColumn('Rank') 
  
function scoreLevel () 
    local account = getPlayerAccount(source) 
    local level = getElementData(source, "player.level") 
    if isGuestAccount(account) then 
        setElementData(source, "Rank", "ranks/guest.png") --Show the image for guest players 
    else 
        setElementData(source, "Rank", tostring("Rank_"..level..".png" )) --Show the images rank 
    end 
end 
addEventHandler("onPlayerLogin", getRootElement(), scoreLevel) 

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