Mefisto_PL Posted April 15, 2012 Share Posted April 15, 2012 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
drk Posted April 15, 2012 Share Posted April 15, 2012 I've seen something about this. You must add dxDrawImage somewhere in dxscoreboard. Link to comment
Mefisto_PL Posted April 15, 2012 Author Share Posted April 15, 2012 hmm I found it, I must add elseif column.name == "avatar" then dxDrawImage( topX+theX, y+s(1), 16, 11, content, 0, 0, 0, cWhite, drawOverGUI ) but i don't know when I must put this . Link to comment
drk Posted April 15, 2012 Share Posted April 15, 2012 Where you found it, you can find the solution for your question too, I'm sure. Link to comment
Mefisto_PL Posted April 15, 2012 Author Share Posted April 15, 2012 Another player wrote I must add it on line 705 but scoreboard doesn't working when I add this .. Link to comment
TAPL Posted April 15, 2012 Share Posted April 15, 2012 Another player wrote I must add it on line 705 but scoreboard doesn't working when I add this .. you need to get last scoreboard then add it on line 705 http://mtasa-resources.googlecode.com/f ... s-r841.zip Link to comment
Mefisto_PL Posted April 16, 2012 Author Share Posted April 16, 2012 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
Mefisto_PL Posted April 16, 2012 Author Share Posted April 16, 2012 So nobody can help me? : Link to comment
MIKI785 Posted April 16, 2012 Share Posted April 16, 2012 Can you post more lines before that? because that else elseif column.name == "avatar" then Doesn't look so good.. Link to comment
Mefisto_PL Posted April 16, 2012 Author Share Posted April 16, 2012 Oh my fail. I change it to "if" but it doesn't helps Link to comment
Kenix Posted April 16, 2012 Share Posted April 16, 2012 Just learn lua. viewtopic.php?f=148&t=40809 Anyway use /debugscript 3. Link to comment
Mefisto_PL Posted April 16, 2012 Author Share Posted April 16, 2012 Doesn't show anything I use debug : / Link to comment
MatXpl Posted April 16, 2012 Share Posted April 16, 2012 without 'else' only 'elseif' Link to comment
TAPL Posted April 16, 2012 Share Posted April 16, 2012 -_-" http://www.mediafire.com/?eoeb5hy3flth7mi Link to comment
Mefisto_PL Posted April 16, 2012 Author Share Posted April 16, 2012 You're my god :3 Thank You very much. Scoreboard It's working (YEAH), but doesn't show Avatar.. Link to comment
TAPL Posted April 16, 2012 Share Posted April 16, 2012 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
Mefisto_PL Posted April 16, 2012 Author Share Posted April 16, 2012 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
Castillo Posted April 16, 2012 Share Posted April 16, 2012 Your column name is "Avatar", but your element data is "avatar", lower case "a". Link to comment
Mefisto_PL Posted April 16, 2012 Author Share Posted April 16, 2012 LOL It's shows avatar number.. not image. Link to comment
TAPL Posted April 16, 2012 Share Posted April 16, 2012 make sure you have put it "Avatar" in dxscoreboard_client.lua Link to comment
Mefisto_PL Posted April 16, 2012 Author Share Posted April 16, 2012 if in dxscoreboard_client.lua is "avatar" show only column , but if is "Avatar" show avatar number. Link to comment
TAPL Posted April 16, 2012 Share Posted April 16, 2012 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
Mefisto_PL Posted April 16, 2012 Author Share Posted April 16, 2012 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
TAPL Posted April 17, 2012 Share Posted April 17, 2012 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now