ViRuZGamiing Posted December 27, 2013 Posted December 27, 2013 Hello, Tell me what I need to make a scoreboard from scratch with username, group, playtime and ping "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
Drakath Posted December 28, 2013 Posted December 28, 2013 getPlayerName getPlayerPing getElementData( player, group ) --Needs an additional script to set the group element data. getElementData( player, playtime ) --Needs an additional script to set the play time element data.
ViRuZGamiing Posted December 28, 2013 Author Posted December 28, 2013 Okay, So i know this, pName = getPlayerName (thePlayer) pPing = getPlayerPing(thePlayer) acc = getPlayerAccount(thePlayer) if acc and not isGuestAccount(acc) then team = getPlayerTeam(thePlayer) if team then setAccountData(acc, "team", getTeamName(team)) Playtime I will figure out but how to draw this data on a dxDrawRectangle? "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
Noki Posted December 29, 2013 Posted December 29, 2013 Use dxDrawText within the rectangle. local ping = getPlayerPing(thePlayer) dxDrawText(""..ping.."", rest of the arguments)
ViRuZGamiing Posted December 29, 2013 Author Posted December 29, 2013 Thx, Btw nice avatar. "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
ViRuZGamiing Posted December 29, 2013 Author Posted December 29, 2013 Another thing; getPlayerName gets only 1 name, right? I need every player on the scoreboard. "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
bandi94 Posted December 29, 2013 Posted December 29, 2013 for i,player in pairs(getElementsByType("player")) do dxDraw(getPlayerName(player), ......) end Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
ViRuZGamiing Posted December 29, 2013 Author Posted December 29, 2013 Does this enter everyname? Like Name1 Name2 instead of Name1Name2 "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
TAPL Posted December 29, 2013 Posted December 29, 2013 You will never create anything better than MTA default scoreboard.
ViRuZGamiing Posted December 29, 2013 Author Posted December 29, 2013 It doesn't need to be better, I want to have a scoreboard having an Image instead of an Rectangle, and no setting button also. "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
bandi94 Posted December 29, 2013 Posted December 29, 2013 You need the start Y poz, then draw player name , then increase Y by the used font Height*1.5 , then draw the next player , and again increase Y and ... Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
ViRuZGamiing Posted December 29, 2013 Author Posted December 29, 2013 Bandi I will try some stuff out 'as I know you are very experienced with dxDrawings' and post the code in here. "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
ViRuZGamiing Posted December 29, 2013 Author Posted December 29, 2013 @bandi94 can I connect you over skype (chat not call) "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
bandi94 Posted December 29, 2013 Posted December 29, 2013 Check your PM Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
ViRuZGamiing Posted December 29, 2013 Author Posted December 29, 2013 local text_h = dxGetFontHeight(1,"bankgothic") addEventHandler("onClientRender",root, function () local name_X = 350 local team_X = 700 local ping_X = 950 local name_Y = 200 local namend_Y = 700 if not getKeyState("tab") then return end dxDrawRectangle(250, 100, 800, 600, tocolor(0, 100, 255, 150), true) dxDrawText("Belgium-Reallife", 250, 100, 1050, 200, tocolor(255, 255, 255, 255), 2.00, "bankgothic", "center", "center", false, false, true, false, false) dxDrawLine(250, 200, 1050, 200, tocolor(255, 255, 255, 255), 1, true) dxDrawLine(550, 200, 550, 700, tocolor(255, 255, 255, 255), 1, true) dxDrawLine(850, 200, 850, 700, tocolor(255, 255, 255, 255), 1, true) --dxDrawText("Team1", 550, 200, 850, 700, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "top", false, false, true, false, false) --dxDrawText("Ping1", 850, 200, 1050, 700, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "top", false, false, true, false, false) if name_Y > namend_Y then return end for i,player in pairs(getElementsByType("player")) do dxDrawText(getPlayerName(player),name_X,name_Y,name_X*1.2,name_Y*1.2,tocolor ( 255, 255, 255, 255 ), 1.0, "pricedown" ) name_Y = name_Y + text_h*1.5 end end) This is what I got, it works but the text is drawed behind the rectangle, how to fix? "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
Castillo Posted December 29, 2013 Posted December 29, 2013 local text_h = dxGetFontHeight ( 1, "bankgothic" ) addEventHandler("onClientRender",root, function ( ) local name_X = 350 local team_X = 700 local ping_X = 950 local name_Y = 200 local namend_Y = 700 if ( not getKeyState ( "tab" ) ) then return end if ( name_Y > namend_Y ) then return end dxDrawRectangle(250, 100, 800, 600, tocolor(0, 100, 255, 150), false) dxDrawText("Belgium-Reallife", 250, 100, 1050, 200, tocolor(255, 255, 255, 255), 2.00, "bankgothic", "center", "center", false, false, true, false, false) dxDrawLine(250, 200, 1050, 200, tocolor(255, 255, 255, 255), 1, false) dxDrawLine(550, 200, 550, 700, tocolor(255, 255, 255, 255), 1, false) dxDrawLine(850, 200, 850, 700, tocolor(255, 255, 255, 255), 1, false) --dxDrawText("Team1", 550, 200, 850, 700, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "top", false, false, true, false, false) --dxDrawText("Ping1", 850, 200, 1050, 700, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "top", false, false, true, false, false) for _, player in ipairs ( getElementsByType ( "player" ) ) do dxDrawText ( getPlayerName ( player ), name_X, name_Y, name_X * 1.2, name_Y * 1.2, tocolor ( 255, 255, 255, 255 ), 1.0, "pricedown" ) name_Y = ( name_Y + text_h * 1.5 ) end end ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
ViRuZGamiing Posted December 29, 2013 Author Posted December 29, 2013 The name is still behind the rectangle "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
Castillo Posted December 29, 2013 Posted December 29, 2013 Copy it again. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
ViRuZGamiing Posted December 29, 2013 Author Posted December 29, 2013 LOL, maybe something went wrong with copying but indeed it works now. Can I also do this; for _, player in ipairs ( getElementsByType ( "player" ) ) do dxDrawText ( getPlayerName ( player ), name_X, name_Y, name_X * 1.2, name_Y * 1.2, tocolor ( 255, 255, 255, 255 ), 1.0, "pricedown" ) name_Y = ( name_Y + text_h * 1.5 ) end For Ping? "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
ViRuZGamiing Posted December 29, 2013 Author Posted December 29, 2013 I tried this but didn't work; for _, player in ipairs ( getPlayerPing( thePlayer ) ) do dxDrawText ( getPlayerPing( thePlayer ), ping_X, name_Y, name_X * 1.2, name_Y * 1.2, tocolor ( 255, 255, 255, 255 ), 1.0, "pricedown" ) name_Y = ( name_Y + text_h * 1.5 ) end "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
Castillo Posted December 29, 2013 Posted December 29, 2013 Use the same loop as for names, and add a new dxDrawText which draws the player ping. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
ViRuZGamiing Posted December 29, 2013 Author Posted December 29, 2013 I know how to draw but how to correctly loop as mine is wrong. "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
ViRuZGamiing Posted December 29, 2013 Author Posted December 29, 2013 Could this work? for _, player in ipairs ( getElementsByType ( "player" ) ) do dxDrawText ( getPlayerPing(getLocalPlayer()), ping_X, name_Y, ping_X * 1.2, name_Y * 1.2, tocolor ( 255, 255, 255, 255 ), 1.0, "bankgothic" ) name_Y = ( name_Y + text_h * 1.5 ) end "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
ViRuZGamiing Posted December 29, 2013 Author Posted December 29, 2013 Okay it works no problem "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
Castillo Posted December 29, 2013 Posted December 29, 2013 That'll only obtain the ping from the local player. local text_h = dxGetFontHeight ( 1, "bankgothic" ) addEventHandler("onClientRender",root, function ( ) local name_X = 350 local team_X = 700 local ping_X = 950 local name_Y = 200 local namend_Y = 700 if ( not getKeyState ( "tab" ) ) then return end if ( name_Y > namend_Y ) then return end dxDrawRectangle(250, 100, 800, 600, tocolor(0, 100, 255, 150), false) dxDrawText("Belgium-Reallife", 250, 100, 1050, 200, tocolor(255, 255, 255, 255), 2.00, "bankgothic", "center", "center", false, false, true, false, false) dxDrawLine(250, 200, 1050, 200, tocolor(255, 255, 255, 255), 1, false) dxDrawLine(550, 200, 550, 700, tocolor(255, 255, 255, 255), 1, false) dxDrawLine(850, 200, 850, 700, tocolor(255, 255, 255, 255), 1, false) --dxDrawText("Team1", 550, 200, 850, 700, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "top", false, false, true, false, false) --dxDrawText("Ping1", 850, 200, 1050, 700, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "top", false, false, true, false, false) for _, player in ipairs ( getElementsByType ( "player" ) ) do dxDrawText ( getPlayerName ( player ), name_X, name_Y, name_X * 1.2, name_Y * 1.2, tocolor ( 255, 255, 255, 255 ), 1.0, "pricedown" ) dxDrawText ( tostring ( getPlayerPing ( player ) ), ping_X, name_Y, ping_X * 1.2, name_Y * 1.2, tocolor ( 255, 255, 255, 255 ), 1.0, "pricedown" ) name_Y = ( name_Y + text_h * 1.5 ) end end ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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