Jump to content

Add pictur's level in scoreboard


//_Dragon

Recommended Posts

http://imgur.com/G5KAbBd

Guys i want add picture's level & number's level in scoreboard

here are the script

server :

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",":Experience/Emblems/Guest.png")

else

setElementData(source, "Level", ":Experience/Emblems/"..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

Set element data of the player, lets say, 'level_icon', to

{ 
    ["type"] = "image", 
    ["src"] = ":resource/file.ext", 
    ["color"] = tocolor(255,255,255,255), 
    ["width"] = 20, 
    ["height"] = 20, 
} 

, then add a column to show level_icon element data under an unnamed column:

exports.scoreboard:addScoreboardColumn("level_icon",getRootElement(),1,40," ") --Last argument, friendly name, is just a space in a string. 

  • Like 1
Link to comment

MrTasty

Not Working :/ can u put that's code in server ↓↓

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",":Experience/Emblems/Guest.png")

else

setElementData(source, "Level", ":Experience/Emblems/"..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
MrTasty

Not Working :/ can u put that's code in server ↓↓

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",":Experience/Emblems/Guest.png")

else

setElementData(source, "Level", ":Experience/Emblems/"..tostring(Level)..".png" )

end

end

addEventHandler("onPlayerSpawn", getRootElement(), scoreLevel)

addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),function()

call(getResourceFromName("scoreboard"),"addScoreboardColumn","Level", getRootElement(), 1, 40)

end

)

Use


tag.

Link to comment
MrTasty

Not Working :/ can u put that's code in server ↓↓

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",":Experience/Emblems/Guest.png")

else

setElementData(source, "Level", ":Experience/Emblems/"..tostring(Level)..".png" )

end

end

addEventHandler("onPlayerSpawn", getRootElement(), scoreLevel)

addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),function()

call(getResourceFromName("scoreboard"),"addScoreboardColumn","Level", getRootElement(), 1, 40)

end

)

Use


tag.

You mean : server.lua !?

Link to comment

Try this:

exports.scoreboard:addScoreboardColumn ( "Level", getRootElement(), 9, 0.07 ) 
  
function scoreLevel () 
local account = getPlayerAccount(source) 
local Level = getElementData(source,"Level") or 0 
if isGuestAccount ( account ) then 
setElementData(source, "Level",":Experience/Emblems/Guest.png") 
else 
local test = ":Experience/Emblems/"..tostring(Level)..".png" 
setElementData(source, "Level", test and {type = "image", src =  test, height = 12, width = 16} or "N/A") 
end 
end 
addEventHandler("onPlayerSpawn", getRootElement(), scoreLevel) 

Link to comment
Try this:
exports.scoreboard:addScoreboardColumn ( "Level", getRootElement(), 9, 0.07 ) 
  
function scoreLevel () 
local account = getPlayerAccount(source) 
local Level = getElementData(source,"Level") or 0 
if isGuestAccount ( account ) then 
setElementData(source, "Level",":Experience/Emblems/Guest.png") 
else 
local test = ":Experience/Emblems/"..tostring(Level)..".png" 
setElementData(source, "Level", test and {type = "image", src =  test, height = 12, width = 16} or "N/A") 
end 
end 
addEventHandler("onPlayerSpawn", getRootElement(), scoreLevel) 

http://imgur.com/v82uwBZ | Not Working :/

Any one help ?

Link to comment
Hmm, as far as I know, you must edit scoreboard itself?

Actually, my code should work with the unmodified version of scoreboard (or more technically, dxscoreboard) - it is based on an extract from the voice resource which displays an icon on the scoreboard depending on the voice-state of a player (speaking, not speaking, muted) on the default scoreboard resource

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