DrPhoX Posted February 14, 2013 Posted February 14, 2013 Hello, i tried to put together script "Country and flags" to one scoreboard column but when i tried it, script doesn't work and i don't know why... Can you tell my where's is my mistake? or correct it for me I will be happy. There is script: exports.scoreboard:addScoreboardColumn(' Home', getRootElement(), 1, 0.025) function showcountry() local flag = exports.admin:getPlayerCountry ( source ) local home = call(getResourceFromName("admin"), "getPlayerCountry", source) if flag and home then setElementData(source," Home",":admin/client/images/flags/"..flag..".png",home) else flag = "N/A" home = "EU" end end addEventHandler("onPlayerJoin",getRootElement(),showcountry) And do you know how to align text to the middle? Thank you
DrPhoX Posted February 15, 2013 Author Posted February 15, 2013 Can someone help me? Do not ignore my topic please, i need a little help -.-
HunT Posted February 15, 2013 Posted February 15, 2013 Can someone help me? Do not ignore my topic please, i need a little help -.- Error debug? U have edit scoreboard?
DrPhoX Posted February 15, 2013 Author Posted February 15, 2013 joao1234: Double post was because my topic was old 1 day but without response... Hunterix: I don't know if i have error in debugscript i have many errors and warnings what spamming debugscript chat And yes, scoreboard is edited but there is not problem... I had it split (Flags and country "CZ","EU","PL" etc..) but I decided that I will try to give it to one scoreboard column but i don't know how
Castillo Posted February 15, 2013 Posted February 15, 2013 That doesn't make much sense, "flag" and "home" is the same thing. exports.scoreboard:addScoreboardColumn(' Home', getRootElement(), 1, 0.025) function showcountry ( ) local flag = exports.admin:getPlayerCountry ( source ) or "N/A" if ( flag ) then setElementData ( source, " Home", ":admin/client/images/flags/".. home:lower ( ) ..".png" ) end end addEventHandler ( "onPlayerJoin", getRootElement(), showcountry ) Try it.
DrPhoX Posted February 16, 2013 Author Posted February 16, 2013 Thank you for responding but this code doesn't work I tried it as "server" and "client" side... Don't work EDIT: Castillo, i think you created code without country names.. I want with country flag and shortcut from country names... Example: " .. flag .. " CZ | PlayerName " .. flag .. " PL | PlayerName i hope if you understand
Castillo Posted February 16, 2013 Posted February 16, 2013 You are talking about the scoreboard, right? if you want to also draw the country code, then you can save the country code, and on the scoreboard, draw the image with the path using the country code, then draw also a text.
DrPhoX Posted February 16, 2013 Author Posted February 16, 2013 Ok, but how? I'm not so good in lua scripting
Castillo Posted February 16, 2013 Posted February 16, 2013 I guess you have edited the scoreboard to add the country flag, right?
DrPhoX Posted February 16, 2013 Author Posted February 16, 2013 Oh.. wait... i ascertain that i haven't edited scoreboard_client but flags was working withnout code in scoreboard... i don't know why... Wait, i try to found code for scoreboard flags...
DrPhoX Posted February 16, 2013 Author Posted February 16, 2013 Ok, i have added to scoreboard_client.lua this code: elseif column.name == " Home" then dxDrawImage( topX+theX, y+s(1), 16, 11, content, 0, 0, 0, cWhite, drawOverGUI ) after line 739 because there i have added ping image... So, scoreboard is working but flags and country shortcut names not
Castillo Posted February 16, 2013 Posted February 16, 2013 For scoreboard: elseif column.name == "Home" then local imagePath = ":admin/client/images/flags/".. content:lower ( ) ..".png" if ( fileExists ( imagePath ) ) then dxDrawImage( topX+theX, y+s(1), 16, 11, imagePath, 0, 0, 0, cWhite, drawOverGUI ) end dxDrawText( content, topX+theX+s(1)+20, 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+20, 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 ) Script to set home: exports.scoreboard:addScoreboardColumn ( 'Home', getRootElement(), 1, 0.06 ) function showcountry ( ) local flag = exports.admin:getPlayerCountry ( source ) or "N/A" if ( flag ) then setElementData ( source, "Home", flag ) end end addEventHandler ( "onPlayerJoin", getRootElement(), showcountry )
DrPhoX Posted February 16, 2013 Author Posted February 16, 2013 Nice! Now it's work perfectlly! ) Thank you so much! You are for me best user and scripter on forum
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