Blaawee Posted January 2, 2012 Posted January 2, 2012 hi guys i found an old scoreboard and there was this line : elseif column.name == "countryCode" then if content ~= "N/A" then local countryImage = "flags/"..string.lower(content)..".png" dxDrawImage(topX+theX, y+s(1)-2, 16, 16, countryImage,0,0,0,tocolor( 255,255,255,255 ), true) end all i wana to do to make it work , what is the right to do
FatalTerror Posted January 3, 2012 Posted January 3, 2012 Hi It's simple... When you set the data in the scoreboard, the column name must be "countryCode" per example. And it must be a number (0-9). When the player press in tab, the scoreboard go search in his files the pic "flags/(0-9).png". Example ? exports.scoreboard:addScoreboardColumn("countryCode", getRootElement(), 1, 0.2) -- Arguments: 1th is the column name, 2nd is getRootElement(), 3rd is the value, 4th is the size Good luck, FatalTerror Edit: the img must be in scoreboard resource
Blaawee Posted January 3, 2012 Author Posted January 3, 2012 you mean like this : exports.scoreboard:addScoreboardColumn("countryCode", getRootElement(), 16, 16) the img already in the scoreboard with size 16×16
bandi94 Posted January 3, 2012 Posted January 3, 2012 add this on line 705 (maybe you need to ad somewhere els bk your scoreboard is difrent) elseif column.name == "Pic" then dxDrawImage( topX+theX, y+s(1), 16, 11, content, 0, 0, 0, cWhite, drawOverGUI ) and set the flag like this notice that admin panel recognize some countryes for what he don't have flag's so you can put a check function to check if is a flag or not else if a country is whitout flag you will be spamed in debugscript whit dxDrawImage can't load file path local flag = exports.admin:getPlayerCountry ( source ) if flag then setElementData(source,"Pic",":admin/client/images/flags/"..flag..".png") end
Blaawee Posted January 3, 2012 Author Posted January 3, 2012 what if his country flag not in the admin panel ?
bandi94 Posted January 3, 2012 Posted January 3, 2012 it will set on ElementData a file (image) what dosen't exist and the dxDrawImage (scoreboard) will spam in debugscript 3 "dxDrawImage can't load file path" that's all use this https://wiki.multitheftauto.com/wiki/FileExists
Blaawee Posted January 3, 2012 Author Posted January 3, 2012 i got : failed to call "admin:getPlayerCountry [srting "?"] what if i make it : call(getResourceFromName("admin"), "getPlayerCountry", source) samething ><
bandi94 Posted January 3, 2012 Posted January 3, 2012 local flag = exports.admin:getPlayerCountry ( source ) "source" must be a player ther is source bk i use it whit "onPlayerJoin" you can change source whit player or whaat you use ...
Blaawee Posted January 3, 2012 Author Posted January 3, 2012 (edited) EDIT Edited January 7, 2012 by Guest
bandi94 Posted January 3, 2012 Posted January 3, 2012 Orange : we don't need your crap useless post's help or shut up and don't spam ----flag.lua exports.scoreboard:addScoreboardColumn('Home') function showcountry() local flag = exports.admin:getPlayerCountry ( source ) if flag then setElementData(source,"Home",":admin/client/images/flags/"..flag..".png") else flag = "N/A" end end addEventHandler("onPlayerJoin",getRootElement(),showcountry) <meta> <script src="flag.lua" type="server" /> </meta>
Blaawee Posted January 3, 2012 Author Posted January 3, 2012 thx guys that's work fine i'm gona move the img to right littl bit
bandi94 Posted January 3, 2012 Posted January 3, 2012 No Problem. Also you can use : exports.scoreboard:addScoreboardColumn('Home',columnPosition ,columnSize)
HunT Posted January 3, 2012 Posted January 3, 2012 For names u can made the table with : IT = "Italy" MX = "Mexico" . . .etc and call the name country with event onPlayerJoin type outputChatBox getPlayerName(source) + name table
GTX Posted January 3, 2012 Posted January 3, 2012 On my server it isn't working.. Why? Did you add the script to ACL?
GTX Posted January 3, 2012 Posted January 3, 2012 You changed the script? If yes, show it. Are you running the script on a local server?
GTX Posted January 3, 2012 Posted January 3, 2012 Well, if is the server local I think the script can't get the country somehow, I can't explain
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