Jump to content

setElementData (Scoreboard avatar)


Mefisto_PL

Recommended Posts

I would like to make a show avatar in scoreboard, I search something to help and I wrote that, but it's make a column only and don't show a image..

exports.scoreboard:addScoreboardColumn('Avatar', getRootElement(), 64, 64) 
  
function showavatar() 
local avatar = getElementData( player, "avatar" ) 
    if avek then 
    local avek_file = getElementData( player, "avatar_file" ) 
    setElementData(source,"avatar",":Panel-F7/avatars/"..avek_file..".png") 
    else 
    avek = "N/A" 
    
    end 
end 
addEventHandler("onPlayerJoin",getRootElement(),showavatar) 
  

Link to comment

It looks like this: (doesn't working -_-)

else 
elseif column.name == "avatar" then 
 dxDrawImage( topX+theX, y+s(1), 16, 11, content, 0, 0, 0, cWhite, drawOverGUI ) 
 dxDrawText( content, topX+theX+s(1),    y+s(1), topX+x+s(1+column.width),   y+s(11)+dxGetFontHeight(fontscale(contentFont, scoreboardScale), contentFont ),    tocolor( 0, 0, 0, a or 255 ), fontscale(contentFont, s(1)), contentFont, "left", "top", true, false, drawOverGUI ) 
 dxDrawText( content, topX+theX,         y,      topX+x+s(column.width),     y+dxGetFontHeight( fontscale(contentFont, scoreboardScale), contentFont ),          tocolor( r or 255, g or 255, b or 255, a or 255 ), fontscale(contentFont, s(1)), contentFont, "left", "top", true, false, drawOverGUI ) 
end 
 end 

Lines 704-710

Link to comment

how it will work with mess code? -_-"

I'm not your god -_-"

exports.scoreboard:addScoreboardColumn('avatar', root, 64, 64) 
  
function showavatar() 
    local avek_file = getElementData(source, "avatar_file") 
    if avek_file then 
    setElementData(source,"avatar",":Panel-F7/avatars/"..avek_file..".png") 
    else 
    setElementData(source,"avatar","N/A") 
    end 
end 
addEventHandler("onPlayerJoin",root,showavatar) 

Link to comment

still doesn't show avatar

Script.lua

exports.scoreboard:addScoreboardColumn("Avatar", root, 1, 64) 
  
function showavatar() 
    local avek_file = getElementData(source, "avatar_file") 
    if avek_file then 
    setElementData(source,"avatar",":Panel-F7/avatars/"..avek_file..".png") 
    else 
    setElementData(source,"avatar","N/A") 
    end 
end 
addEventHandler("onPlayerJoin",root,showavatar) 

dxscoreboard_client.lua

elseif column.name == "Avatar" then 
dxDrawImage( topX+theX, y+s(1), 16, 11, content, 0, 0, 0, cWhite, drawOverGUI) 
else    dxDrawText( content, topX+theX+s(1),    y+s(1), topX+x+s(1+column.width),   y+s(11)+dxGetFontHeight( fontscale(contentFont, scoreboardScale), contentFont ),    tocolor( 0, 0, 0, a or 255 ), fontscale(contentFont, s(1)), contentFont, "left", "top", true, false, drawOverGUI ) 
dxDrawText( content, topX+theX,         y,      topX+x+s(column.width),     y+dxGetFontHeight( fontscale(contentFont, scoreboardScale), contentFont ),          tocolor( r or 255, g or 255, b or 255, a or 255 ), fontscale(contentFont, s(1)), contentFont, "left", "top", true, false, drawOverGUI ) 
end 

Link to comment
if in dxscoreboard_client.lua is "avatar" show only column , but if is "Avatar" show avatar number.

it's must be the same in dxscoreboard_client.lua and same in column name and same element data

if the column is empty then you haven't any data called "avatar_file"

also i think you should use event onResourceStart because when you join to the server it's almost you wouldn't have any data

Link to comment

It doesn't helps.. and I put here everything what I have with data.

    setElementData( who, "avatar", loadPlayerData(who,"avatar") ) 
loadPlayerData(Who,"avatar") 
savePlayerData( Who, "avatar", id ) 
setElementData( Who, "avatar", id ) 
setElementData( Who, "avatar_file", ":Panel-F7/" .. file ) 
setElementData( Who, "avatar_file", ":Panel-F7/" .. file ) 

Link to comment
It doesn't helps.. and I put here everything what I have with data.
    setElementData( who, "avatar", loadPlayerData(who,"avatar") ) 
loadPlayerData(Who,"avatar") 
savePlayerData( Who, "avatar", id ) 
setElementData( Who, "avatar", id ) 
setElementData( Who, "avatar_file", ":Panel-F7/" .. file ) 
setElementData( Who, "avatar_file", ":Panel-F7/" .. file ) 

~_~

this is realy mess ._.

i still don't know what is the fucking avatar

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