• DarkRP Hud ScrH() And ScrW() Help
    8 replies, posted
I really dont under stand Screen width and or hight when making my hud for my darkrp server, can so one please explain in way which any one could under stand?
Professional slides incoming ( JK ) [img]http://i.imgur.com/4jGRUTZ.png[/img] [img]http://i.imgur.com/SB9OFl7.png[/img] What makes this important? [img]http://i.imgur.com/lnCO68F.png[/img]
So what side does screen width start? [editline]9th March 2015[/editline] [QUOTE=Robotboy655;47288221]Professional slides incoming ( JK ) [img]http://i.imgur.com/4jGRUTZ.png[/img] [img]http://i.imgur.com/SB9OFl7.png[/img] What makes this important? [img]http://i.imgur.com/lnCO68F.png[/img][/QUOTE] so is [code] ScrW() /110 , ScrH () /1.14 [/code] the bottem left for all people?
Don't confuse POSITION and SIZE. All coordinates start with 0, 0 in the TOP LEFT corner. local w = ScrW() / 110 local h = ScrH() / 1.14 local x = 0 local y = ScrH() - h Use these to draw a rectangle on the bottom left corner.
[QUOTE=Robotboy655;47289416]Don't confuse POSITION and SIZE. All coordinates start with 0, 0 in the TOP LEFT corner. local w = ScrW() / 110 local h = ScrH() / 1.14 local x = 0 local y = ScrH() - h Use these to draw a rectangle on the bottom left corner.[/QUOTE] So is it right?
[QUOTE=Borris_Squad;47295408]So is it right?[/QUOTE] Is what right? Dividing numbers won't magically make make your HUD move to bottom left.
[QUOTE=Robotboy655;47295574]Is what right? Dividing numbers won't magically make make your HUD move to bottom left.[/QUOTE] ScrW() /110 , ScrH () /1.14 goto the bottom of people screen? Becuase it does on mine
[QUOTE=Borris_Squad;47295719]ScrW() /110 , ScrH () /1.14 goto the bottom of people screen? Becuase it does on mine[/QUOTE] Show your entire code. I can't tell you if what you are doing is right if the only thing you give me is "2 / 2". [editline]10th March 2015[/editline] Besides, just change your in-game resolution to something else and see if it works.
[code] local function Base() draw.RoundedBox(0, ScrW() /120 , ScrH () /1.14 , 350, 125, Color(0, 0, 0, 200)) --- Hud Base local DrawHealth = LocalPlayer():Health() or 0 local EchoHealth = LocalPlayer():Health() or 0 if DrawHealth > 100 then DrawHealth = 100 end if DrawHealth < 0 then DrawHealth = 0 end if DrawHealth != 0 then draw.RoundedBox(0, ScrW() /5.191 , ScrH() /1.029, (130 + 0) * DrawHealth / 100, 15.5, Color(255, 0, 0, 250)) --- Health end draw.RoundedBox(0, ScrW() /5.191 , ScrH() /1.031, 130.5, 19.5, Color(0, 0, 0, 250)) --- Black Outline Health draw.SimpleText("Health: ".. EchoHealth, "TargetID", ScrW() /5.050 , ScrH() /1.035, Color(255,255,255,255)) --- Health Text local DrawHealth = math.ceil(LocalPlayer():getDarkRPVar("Energy") or 0) local EchoHealth = math.ceil(LocalPlayer():getDarkRPVar("Energy") or 0) draw.RoundedBox(0, ScrW() - 1640 - -90, ScrH () - 41 - 10, (130) * DrawHealth / 100, 15.5, Color(3, 250, 11, 250)) --- Hunger draw.SimpleText("Hunger", "TargetID", ScrW() - 1640 - -130, ScrH() - 41 - 12, Color(255, 255, 255,255)) --- Hunger Text draw.RoundedBox(0, ScrW() - 1640 - -90, ScrH () - 41.5 - 11.5, 130.5, 19.5, Color(0, 0, 0, 250)) --- Black Outline Hunger draw.RoundedBox(0, ScrW() - 1640 - -90, ScrH () - 62 - 11.5, 130.5, 19.5, Color(0, 0, 0, 250)) --- Black Outline Armor local DrawHealth = LocalPlayer():Armor() or 0 local EchoHealth = LocalPlayer():Armor() or 0 draw.RoundedBox(0, ScrW() - 1640 - -90, ScrH () - 62 - 10, (130) * DrawHealth / 100, 15.5, Color(0, 34, 255, 250)) --- Armor draw.SimpleText("Armor: ".. EchoHealth, "TargetID", ScrW() - 1640 - -110, ScrH() - 62 - 12, Color(255,255,255,255)) --- Armor Text draw.RoundedBox(3, ScrW() /110 , ScrH () /50 , 470, 30, Color(0, 0, 0, 200)) --- Website Link Base local DrawHealth = LocalPlayer():GetNWInt( "tcb_stamina" ) or 0 local DrawHealth = LocalPlayer():GetNWInt( "tcb_stamina" ) or 0 if DrawHealth > 100 then DrawHealth = 100 end if DrawHealth < 0 then DrawHealth = 0 end if DrawHealth != 0 then draw.RoundedBox(0, ScrW() - 1640 - -90, ScrH () - 83 - 10, (130 + 0) * DrawHealth / 100, 15.5, Color(255, 0, 0, 250)) --- Stamina end draw.RoundedBox(0, ScrW() - 1640 - -90, ScrH () - 82.5 - 11.5, 130.5, 19.5, Color(0, 0, 0, 250)) --- Black Outline Stamina draw.SimpleText(" Stamina", "TargetID", ScrW() - 1640 - -110, ScrH() -83 - 12, Color(255,255,255,255)) --- Stamina Text local DrawHealth = LocalPlayer():Health() or 0 local EchoHealth = LocalPlayer():Health() or 0 draw.SimpleText("Name: ".. LocalPlayer():Name(), "TargetID", ScrW() /90 , ScrH() /1.14 , Color(255,255,255,255)) --- Name Text draw.SimpleText("Occupation:".. LocalPlayer():getDarkRPVar( "job" ), "TargetID", ScrW() /90 , ScrH() /1.122 , Color(255,255,255,255)) --- Job Text draw.SimpleText("Money: " .. LocalPlayer():getDarkRPVar( "money" ), "TargetID", ScrW() /90 , ScrH() /1.104, Color(255,255,255,255)) --- Money Text draw.SimpleText("Salary: ", "TargetID", ScrW() /90 , ScrH() /1.086 , Color(255,255,255,255)) --- Salary Text draw.SimpleText("Clan:", "TargetID", ScrW() /90, ScrH() /1.066 , Color(255,255,255,255)) --- Clan Text draw.SimpleText("Description: A new citizen of Evocity", "TargetID", ScrW() /90 , ScrH() /1.050, Color(255,255,255,255)) --- Information Text draw.SimpleText("Ingame Time:", "TargetID", ScrW() /90 , ScrH() /1.035 , Color(255,255,255,255)) --- Information Text draw.SimpleText("Visit our website:http://civilisationrp.icyboards.net/", "Trebuchet24", ScrW() /110 , ScrH() /40, Color(255, 255, 255,255)) --- Website Link And Or Server Name end local function HudLicense() draw.RoundedBoxEx(6, HUD.PosX+HUD.Width/4-50, HUD.PosY-24, 100, 24, Color(0, 0, 0, 200), true, true, false, false) if LocalPlayer():getDarkRPVar("HasGunlicense") then draw.DrawText(HUD.License2, "TCBFont", HUD.PosX+HUD.Width/4+1, HUD.PosY-24+4+1, Color(0, 0, 0, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) draw.DrawText(HUD.License2, "TCBFont", HUD.PosX+HUD.Width/4, HUD.PosY-24+4, Color(0, 255, 0, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) else draw.DrawText(HUD.License1, "TCBFont", HUD.PosX+HUD.Width/4+1, HUD.PosY-24+4+1, Color(0, 0, 0, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) draw.DrawText(HUD.License1, "TCBFont", HUD.PosX+HUD.Width/4, HUD.PosY-24+4, Color(255, 0, 0, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) end end local function HudWanted() draw.RoundedBoxEx(6, HUD.PosX+HUD.Width-HUD.Width/4-50, HUD.PosY-24, 100, 24, Color(0, 0, 0, 200), true, true, false, false) if LocalPlayer():getDarkRPVar("wanted") then draw.DrawText(HUD.Wanted2, "TCBFont", HUD.PosX+HUD.Width-HUD.Width/4+1, HUD.PosY-24+4+1, Color(0, 0, 0, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) draw.DrawText(HUD.Wanted2, "TCBFont", HUD.PosX+HUD.Width-HUD.Width/4, HUD.PosY-24+4, Color(255, 0, 0, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) else draw.DrawText(HUD.Wanted1, "TCBFont", HUD.PosX+HUD.Width-HUD.Width/4+1, HUD.PosY-24+4+1, Color(0, 0, 0, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) draw.DrawText(HUD.Wanted1, "TCBFont", HUD.PosX+HUD.Width-HUD.Width/4, HUD.PosY-24+4, Color(0, 255, 0, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) end end [/code]
Sorry, you need to Log In to post a reply to this thread.