Blaawee Posted January 2, 2012 Share 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 Link to comment
FatalTerror Posted January 3, 2012 Share 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 Link to comment
Blaawee Posted January 3, 2012 Author Share 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 Link to comment
bandi94 Posted January 3, 2012 Share 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 Link to comment
Blaawee Posted January 3, 2012 Author Share Posted January 3, 2012 what if his country flag not in the admin panel ? Link to comment
FatalTerror Posted January 3, 2012 Share Posted January 3, 2012 You add an "else" and set a Peace Flag Link to comment
bandi94 Posted January 3, 2012 Share 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 Link to comment
Blaawee Posted January 3, 2012 Author Share Posted January 3, 2012 i got : failed to call "admin:getPlayerCountry [srting "?"] what if i make it : call(getResourceFromName("admin"), "getPlayerCountry", source) samething >< Link to comment
bandi94 Posted January 3, 2012 Share 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 ... Link to comment
Blaawee Posted January 3, 2012 Author Share Posted January 3, 2012 (edited) EDIT Edited January 7, 2012 by Guest Link to comment
bandi94 Posted January 3, 2012 Share 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> Link to comment
Blaawee Posted January 3, 2012 Author Share Posted January 3, 2012 thx guys that's work fine i'm gona move the img to right littl bit Link to comment
bandi94 Posted January 3, 2012 Share Posted January 3, 2012 No Problem. Also you can use : exports.scoreboard:addScoreboardColumn('Home',columnPosition ,columnSize) Link to comment
HunT Posted January 3, 2012 Share 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 Link to comment
Mefisto_PL Posted January 3, 2012 Share Posted January 3, 2012 On my server it isn't working.. Why? Link to comment
GTX Posted January 3, 2012 Share Posted January 3, 2012 On my server it isn't working.. Why? Did you add the script to ACL? Link to comment
Mefisto_PL Posted January 3, 2012 Share Posted January 3, 2012 Yes, any errors and warnings. Link to comment
GTX Posted January 3, 2012 Share Posted January 3, 2012 You changed the script? If yes, show it. Are you running the script on a local server? Link to comment
Mefisto_PL Posted January 3, 2012 Share Posted January 3, 2012 I don't change and yes. On hamachi. Link to comment
GTX Posted January 3, 2012 Share Posted January 3, 2012 Well, if is the server local I think the script can't get the country somehow, I can't explain Link to comment
Mefisto_PL Posted January 3, 2012 Share Posted January 3, 2012 Ehh.. So I can't do anything to fix that? 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