AlvarO Posted August 3, 2015 Share Posted August 3, 2015 Hello guys, so I was making the scoreboard for the multigamemode of our clan and I had a problem with country flags: Code: local player = getLocalPlayer() local sx, sy = guiGetScreenSize() local px, py = 1360,768 local x, y = (sx/px), (sy/py) local fpsTick = getTickCount() local fps = 1 local players = getElementsByType( "player" ) function drawScoreboardGUI( ) local country = exports.admin:getPlayerCountry(source) local flag = country and ":admin/client/images/flags/"..country..".png" dxDrawRectangle(x*285, y*125, x*800, y*19, tocolor(50, 150, 210, 220), true) dxDrawRectangle(x*285, y*143, x*800, y*350, tocolor(0, 0, 0, 220), true) dxDrawRectangle(x*285, y*145, x*150, y*19, rectanglecchanger1, true) dxDrawRectangle(x*450, y*145, x*150, y*19, rectanglecchanger2, true) dxDrawRectangle(x*615, y*145, x*150, y*19, rectanglecchanger3, true) dxDrawRectangle(x*780, y*145, x*150, y*19, rectanglecchanger4, true) dxDrawRectangle(x*945, y*145, x*140, y*19, rectanglecchanger5, true) dxDrawText("Victorious Ace 1.0", x*520, y*(-55), x*852, y*326, tocolor(0, 0, 0, 255), x*2, "default-bold", "center", "center", false, false, true, false, false) dxDrawText("Deathmatch", x*(-125), y*(-15), x*852, y*326, tocolor(0, 0, 0, 255), x*1, "default-bold", "center", "center", false, false, true, false, false) dxDrawText("Destruction Derby", x*200, y*(-15), x*852, y*326, tocolor(0, 0, 0, 255), x*1, "default-bold", "center", "center", false, false, true, false, false) dxDrawText("Shooter", x*525, y*(-15), x*852, y*326, tocolor(0, 0, 0, 255), x*1, "default-bold", "center", "center", false, false, true, false, false) dxDrawText("Hunter", x*860, y*(-15), x*852, y*326, tocolor(0, 0, 0, 255), x*1, "default-bold", "center", "center", false, false, true, false, false) dxDrawText("Race", x*1175, y*(-15), x*852, y*326, tocolor(0, 0, 0, 255), x*1, "default-bold", "center", "center", false, false, true, false, false) for i, player in ipairs(getElementsByType("player")) do name = getPlayerName(player) dxDrawRectangle(x*285, y*170, x*800, y*19, tocolor(50, 150, 210, 220), true) --Nombre dxDrawText("Name", x*175, y*35, x*852, y*326, tocolor(0, 0, 0, 255), x*1, "default-bold", "center", "center", false, false, true, false, false) dxDrawRectangle(x*410, y*195, x*635, y*19, tocolor(175, 175, 175, 220), true) dxDrawText(name, x*175, y*85, x*852, y*326, tocolor(0, 0, 0, 255), x*1, "default-bold", "center", "center", false, false, true, true, false) --Pais dxDrawImage(flag, x * 0.4148, y * 0.2627, x * 0.0227, y * 0.0137, tocolor(213, 0, 0, 255), false) end for k,player in ipairs(getElementsByType("player")) do cuenta = k end dxDrawText("Players:"..cuenta.."/50", x*1130, y*(-55), x*852, y*326, tocolor(0, 0, 0, 255), x*1.5, "default-bold", "center", "center", false, false, true, false, false) end Debug: ERROR: va_scoreboard\client.lua:27: call: failed to call 'admin:getPlayerCountr'[string "?"] WARNING: va_scoreboard\client.lua:51: Bad argument @ 'dxDrawImage' [Expected vector2 at argument 1, got boolean] Link to comment
GTX Posted August 3, 2015 Share Posted August 3, 2015 local player = getLocalPlayer() local sx, sy = guiGetScreenSize() local px, py = 1360,768 local x, y = (sx/px), (sy/py) local fpsTick = getTickCount() local fps = 1 local players = getElementsByType( "player" ) function drawScoreboardGUI( ) dxDrawRectangle(x*285, y*125, x*800, y*19, tocolor(50, 150, 210, 220), true) dxDrawRectangle(x*285, y*143, x*800, y*350, tocolor(0, 0, 0, 220), true) dxDrawRectangle(x*285, y*145, x*150, y*19, rectanglecchanger1, true) dxDrawRectangle(x*450, y*145, x*150, y*19, rectanglecchanger2, true) dxDrawRectangle(x*615, y*145, x*150, y*19, rectanglecchanger3, true) dxDrawRectangle(x*780, y*145, x*150, y*19, rectanglecchanger4, true) dxDrawRectangle(x*945, y*145, x*140, y*19, rectanglecchanger5, true) dxDrawText("Victorious Ace 1.0", x*520, y*(-55), x*852, y*326, tocolor(0, 0, 0, 255), x*2, "default-bold", "center", "center", false, false, true, false, false) dxDrawText("Deathmatch", x*(-125), y*(-15), x*852, y*326, tocolor(0, 0, 0, 255), x*1, "default-bold", "center", "center", false, false, true, false, false) dxDrawText("Destruction Derby", x*200, y*(-15), x*852, y*326, tocolor(0, 0, 0, 255), x*1, "default-bold", "center", "center", false, false, true, false, false) dxDrawText("Shooter", x*525, y*(-15), x*852, y*326, tocolor(0, 0, 0, 255), x*1, "default-bold", "center", "center", false, false, true, false, false) dxDrawText("Hunter", x*860, y*(-15), x*852, y*326, tocolor(0, 0, 0, 255), x*1, "default-bold", "center", "center", false, false, true, false, false) dxDrawText("Race", x*1175, y*(-15), x*852, y*326, tocolor(0, 0, 0, 255), x*1, "default-bold", "center", "center", false, false, true, false, false) for i, player in ipairs(getElementsByType("player")) do local country = exports.admin:getPlayerCountry(player) local flag = country and ":admin/client/images/flags/"..country..".png" name = getPlayerName(player) dxDrawRectangle(x*285, y*170, x*800, y*19, tocolor(50, 150, 210, 220), true) --Nombre dxDrawText("Name", x*175, y*35, x*852, y*326, tocolor(0, 0, 0, 255), x*1, "default-bold", "center", "center", false, false, true, false, false) dxDrawRectangle(x*410, y*195, x*635, y*19, tocolor(175, 175, 175, 220), true) dxDrawText(name, x*175, y*85, x*852, y*326, tocolor(0, 0, 0, 255), x*1, "default-bold", "center", "center", false, false, true, true, false) --Pais dxDrawImage(flag, x * 0.4148, y * 0.2627, x * 0.0227, y * 0.0137, tocolor(213, 0, 0, 255), false) end for k,player in ipairs(getElementsByType("player")) do cuenta = k end dxDrawText("Players:"..cuenta.."/50", x*1130, y*(-55), x*852, y*326, tocolor(0, 0, 0, 255), x*1.5, "default-bold", "center", "center", false, false, true, false, false) end Link to comment
GTX Posted August 3, 2015 Share Posted August 3, 2015 I'm not a magician, I need more details; debugscript, what exactly is not working...? Is this your full code? Link to comment
AlvarO Posted August 3, 2015 Author Share Posted August 3, 2015 ERROR: va_scoreboard\client.lua:27: call: failed to call 'admin:getPlayerCountr'[string "?"] WARNING: va_scoreboard\client.lua:51: Bad argument @ 'dxDrawImage' [Expected vector2 at argument 1, got boolean] Link to comment
GTX Posted August 3, 2015 Share Posted August 3, 2015 dxDrawImage(x * 0.4148, y * 0.2627, x * 0.0227, y * 0.0137, flag, tocolor(213, 0, 0, 255), false) Link to comment
AlvarO Posted August 3, 2015 Author Share Posted August 3, 2015 Again the same debug, but instead of that warning, debug says: expected material at argument 5 Link to comment
GTX Posted August 3, 2015 Share Posted August 3, 2015 It should work or you gave me wrong script. Link to comment
AlvarO Posted August 3, 2015 Author Share Posted August 3, 2015 I didn't can you add me in skype for help? Please? 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