Jump to content

Drawing the rank in my scoreboard..


King12

Recommended Posts

Not sure.

  
  
-- Server side 
exports.scoreboard:addScoreboardColumn("Level",getRootElement(),1,40,'Level') 
  
function scoreLevel () 
    local account = getPlayerAccount(source) 
    local Level = getElementData(localPlayer,"Level") or 0 
    if isGuestAccount ( account ) then 
        setElementData(source, "Level","ranks\0.png") 
    else 
        setElementData(source, "Level", "ranks\\"..tostring(Level)..".png" )                                       
    end 
addEventHandler("onPlayerSpawn", getRootElement(), scoreLevel) 
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),function() 
        call(getResourceFromName("scoreboard"),"addScoreboardColumn","Level", getRootElement(), 1, 40) 
    end 
) 
end 
  
  

Link to comment
Not sure.
  
  
-- Server side 
exports.scoreboard:addScoreboardColumn("Level",getRootElement(),1,40,'Level') 
  
function scoreLevel () 
    local account = getPlayerAccount(source) 
    local Level = getElementData(localPlayer,"Level") or 0 
    if isGuestAccount ( account ) then 
        setElementData(source, "Level","ranks\0.png") 
    else 
        setElementData(source, "Level", "ranks\\"..tostring(Level)..".png" )                                       
    end 
addEventHandler("onPlayerSpawn", getRootElement(), scoreLevel) 
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),function() 
        call(getResourceFromName("scoreboard"),"addScoreboardColumn","Level", getRootElement(), 1, 40) 
    end 
) 
end 
  
  

Still draws the number instead of the image.. :x

Link to comment
  
  
  
-- Server side 
exports.scoreboard:addScoreboardColumn("Level",getRootElement(),1,40,'Level') 
  
function scoreLevel () 
    local account = getPlayerAccount(source) 
    local Level = getElementData(localPlayer,"Level") or 0 
    if isGuestAccount ( account ) then 
        setElementData(source, "Level","ranks\0.png") 
    else 
        setElementData(source, "Level", "resourceName:ranks\\"..tostring(Level)..".png" )                                       
    end 
addEventHandler("onPlayerSpawn", getRootElement(), scoreLevel) 
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),function() 
        call(getResourceFromName("scoreboard"),"addScoreboardColumn","Level", getRootElement(), 1, 40) 
    end 
) 
end 
  

Link to comment
  
  
  
-- Server side 
exports.scoreboard:addScoreboardColumn("Level",getRootElement(),1,40,'Level') 
  
function scoreLevel () 
    local account = getPlayerAccount(source) 
    local Level = getElementData(localPlayer,"Level") or 0 
    if isGuestAccount ( account ) then 
        setElementData(source, "Level","ranks\0.png") 
    else 
        setElementData(source, "Level", "resourceName:ranks\\"..tostring(Level)..".png" )                                       
    end 
addEventHandler("onPlayerSpawn", getRootElement(), scoreLevel) 
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),function() 
        call(getResourceFromName("scoreboard"),"addScoreboardColumn","Level", getRootElement(), 1, 40) 
    end 
) 
end 
  

I've changed resourceName, and still extracting my level as a text, maybe because it has tostring function?

Link to comment
exports.scoreboard:addScoreboardColumn("Level",getRootElement(),1,40,'Level') 
  
function scoreLevel () 
    local account = getPlayerAccount(source) 
    local Level = getElementData(source,"Level") or 0 
    if isGuestAccount ( account ) then 
        setElementData(source, "Level","ranks\0.png") 
    else 
        setElementData(source, "Level", ":resourceName/ranks/"..Level..".png" )                                       
    end 
addEventHandler("onPlayerSpawn", getRootElement(), scoreLevel) 
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),function() 
        call(getResourceFromName("scoreboard"),"addScoreboardColumn","Level", getRootElement(), 1, 40) 
    end 
) 
end 
  

Link to comment
exports.scoreboard:addScoreboardColumn("Level",getRootElement(),1,40,'Level') 
  
function scoreLevel () 
    local account = getPlayerAccount(source) 
    local Level = getElementData(source,"Level") or 0 
    if isGuestAccount ( account ) then 
        setElementData(source, "Level","ranks\0.png") 
    else 
        setElementData(source, "Level", ":resourceName/ranks/"..Level..".png" )                                       
    end 
addEventHandler("onPlayerSpawn", getRootElement(), scoreLevel) 
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),function() 
        call(getResourceFromName("scoreboard"),"addScoreboardColumn","Level", getRootElement(), 1, 40) 
    end 
) 
end 
  

Still the same. :|

Link to comment
  • 2 weeks later...
  
exports.scoreboard:addScoreboardColumn("Level",getRootElement(),1,40,'Level') 
  
function scoreLevel () 
    local account = getPlayerAccount(source) 
    local Level = getElementData(source,"Level") or 0 
    if isGuestAccount ( account ) then 
        setElementData(source, "Level",":resourceName/ranks/0.png") 
    else 
        setElementData(source, "Level", ":resourceName/ranks/"..tostring(Level)..".png" )                                       
    end 
addEventHandler("onPlayerSpawn", getRootElement(), scoreLevel) 
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),function() 
        call(getResourceFromName("scoreboard"),"addScoreboardColumn","Level", getRootElement(), 1, 40) 
    end 
) 
end 
  
  

Link to comment

This should work!

  
  
exports.scoreboard:addScoreboardColumn("Level",getRootElement(),1,40,'Level') 
  
function scoreLevel () 
    local account = getPlayerAccount(source) 
    local Level = getElementData(source,"Level") or 0 
    if isGuestAccount ( account ) then 
           setElementData(source, "Level",":resourceName/ranks/0.png") 
    else 
          setElementData(source, "Level", ":resourceName/ranks/"..tostring(Level)..".png" )                                       
     end 
end 
addEventHandler("onPlayerSpawn", getRootElement(), scoreLevel) 
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),function() 
        call(getResourceFromName("scoreboard"),"addScoreboardColumn","Level", getRootElement(), 1, 40) 
    end 
) 
  
  
  

Link to comment

Why it keeps debuging this error if I reconnected from the server and logged in?

LGRQEQ3.jpg

  
addEventHandler("onClientRender", root, 
function () 
    local Level = getElementData(localPlayer,"Level") or 0 
        dxDrawImage(95*sW, 675*sH, 40*sW, 40*sH, Level, 0, 0, 0, tocolor(255, 255, 255, 255), false) -- Line #20 
    end 
) 
  
--Server Side 
exports.scoreboard:addScoreboardColumn("Level",getRootElement(),1,23,'Level') 
  
function scoreLevel () 
    local account = getPlayerAccount(source) 
    local Level = getElementData(source,"Level") or 0 
    if isGuestAccount ( account ) then 
           setElementData(source, "Level",":zGmode/ranks/0.png") 
    else 
          setElementData(source, "Level", ":zGmode/ranks/"..tostring(Level)..".png" )                                       
     end 
end 
addEventHandler("onPlayerSpawn", getRootElement(), scoreLevel) 
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),function() 
        call(getResourceFromName("scoreboard"),"addScoreboardColumn","Level", getRootElement(), 1, 23) 
    end 
) 
  

Link to comment
  
  
addEventHandler("onClientRender", root, 
function () 
    local Level = getElementData(localPlayer,"Level") or 0 
        if Level ~= 0 then 
            dxDrawImage(95*sW, 675*sH, 40*sW, 40*sH, ":zGmode/ranks/0.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) -- Line #20 
        else 
            dxDrawImage(95*sW, 675*sH, 40*sW, 40*sH, Level, 0, 0, 0, tocolor(255, 255, 255, 255), false) -- Line #20 
    end 
) 
  
  
  
  

Link to comment
  
  
  
addEventHandler("onClientRender", root, 
function () 
    local Level = getElementData(localPlayer,"Level") or 0 
        if Level == 0 then 
            dxDrawImage(95*sW, 675*sH, 40*sW, 40*sH, ":zGmode/ranks/0.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) -- Line #20 
        else 
            dxDrawImage(95*sW, 675*sH, 40*sW, 40*sH, Level, 0, 0, 0, tocolor(255, 255, 255, 255), false) -- Line #20 
    end 
) 
  
  

lol did wrong check -.-

Link to comment
  
  
  
addEventHandler("onClientRender", root, 
function () 
    local Level = getElementData(localPlayer,"Level") or 0 
        if Level == 0 then 
            dxDrawImage(95*sW, 675*sH, 40*sW, 40*sH, ":zGmode/ranks/0.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) -- Line #20 
        else 
            dxDrawImage(95*sW, 675*sH, 40*sW, 40*sH, Level, 0, 0, 0, tocolor(255, 255, 255, 255), false) -- Line #20 
    end 
) 
  
  

lol did wrong check -.-

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