Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- include ('shared.lua')
- surface.CreateFont( "MyFont", {
- font = "Arial",
- size = 20,
- weight = 500,
- blursize = 0,
- scanlines = 0,
- antialias = true,
- underline = false,
- italic = false,
- strikeout = false,
- symbol = false,
- rotary = false,
- shadow = false,
- additive = false,
- outline = false,
- } )
- function HUDHide( myhud )
- for k, v in pairs{"CHudHealth", "CHudCrosshair"} do
- if (myhud == v) then
- return false
- end
- end
- end
- hook.Add("HUDShouldDraw","HUDHide",HUDHide)
- function GM:HUDPaint()
- local hunger100 = Material('gamemodes/LG/content/images/food 100.png')
- local hunger75 = Material('gamemodes/LG/content/images/food 75.png')
- local hunger50 = Material('gamemodes/LG/content/images/food 50.png')
- local hunger25 = Material('gamemodes/LG/content/images/food 25.png')
- local hunger0 = Material('gamemodes/LG/content/images/food 0.png')
- local thirst100 = Material('gamemodes/LG/content/images/drink 100.png')
- local thirst75 = Material('gamemodes/LG/content/images/drink 75.png')
- local thirst50 = Material('gamemodes/LG/content/images/drink 50.png')
- local thirst25 = Material('gamemodes/LG/content/images/drink 25.png')
- local thirst0 = Material('gamemodes/LG/content/images/drink 0.png')
- local health100 = Material('gamemodes/LG/content/images/health 100.png')
- local health75 = Material('gamemodes/LG/content/images/health 75.png')
- local health50 = Material('gamemodes/LG/content/images/health 50.png')
- local health25 = Material('gamemodes/LG/content/images/health 25.png')
- local health0 = Material('gamemodes/LG/content/images/health 0.png')
- local coin = Material('gamemodes/LG/content/images/coin.png')
- self.BaseClass:HUDPaint()
- draw.RoundedBox( 14, 25, ScrH() - 280, 400, 260, Color( 0,0,0 ))
- local HP = LocalPlayer():Health()
- local food = LocalPlayer():GetNWFloat('food')
- local water = LocalPlayer():GetNWFloat('water')
- local cash = LocalPlayer():GetNWFloat('money')
- if (string.len(LocalPlayer():GetName()) <= 35) then
- user = LocalPlayer():GetName()
- else
- user = "Username too long!"
- end
- --//MONEY\\--
- surface.SetTextColor( 255, 255, 250, 255 )
- surface.SetTextPos( 25, ScrH() - 50 )
- surface.SetFont("MyFont")
- surface.SetMaterial(coin)
- surface.SetDrawColor( 255, 255, 255, 255 )
- surface.DrawTexturedRect( 25, ScrH() - 70, 34, 50 )
- surface.DrawText( "\n\n\nCash:" )
- surface.SetTextColor( Color(0, 204, 204, 255))
- surface.DrawText( cash )
- --//MONEY\\--
- --//HUNGER\\--
- surface.SetTextColor( 255, 255, 250, 255 )
- surface.SetTextPos( 25, ScrH() - 100 )
- surface.SetFont("MyFont")
- surface.SetDrawColor( 255, 255, 255, 255 )
- if (food <= 100 and food > 75) then
- surface.SetMaterial(hunger100)
- else if (food == 75 and food > 50) then
- surface.SetMaterial(hunger75)
- else if (food == 50 and food > 25) then
- surface.SetMaterial(hunger50)
- else if (food == 25 and food > 0) then
- surface.SetMaterial(hunger25)
- else if (food == 0) then
- surface.SetMaterial(hunger0)
- end
- end
- end
- end
- end
- surface.DrawTexturedRect( 25, ScrH() - 120, 34, 50 )
- surface.DrawText( "\n\n\nHunger:" )
- surface.SetTextColor( Color(0, 204, 204, 255))
- surface.DrawText( food )
- --//HUNGER\\--
- --//WATER\\--
- surface.SetTextColor( 255, 255, 250, 255 )
- surface.SetTextPos( 25, ScrH() - 150 )
- surface.SetFont("MyFont")
- if (water <= 100 and water > 75) then
- surface.SetMaterial(thirst100)
- else if (water == 75 and water > 50) then
- surface.SetMaterial(thirst75)
- else if (water == 50 and water > 25) then
- surface.SetMaterial(thirst50)
- else if (water == 25 and water > 0) then
- surface.SetMaterial(thirst25)
- else if (water == 0) then
- surface.SetMaterial(thirst0)
- end
- end
- end
- end
- end
- surface.SetDrawColor( 255, 255, 255, 255 )
- surface.DrawTexturedRect( 25, ScrH() - 170, 34, 50 )
- surface.DrawText( "\n\n\nThirst:" )
- surface.SetTextColor( Color(0, 204, 204, 255))
- surface.DrawText( water )
- --//WATER\\--
- --//HEALTH\\--
- surface.SetTextColor( 255, 255, 250, 255 )
- surface.SetTextPos( 25, ScrH() - 200 )
- surface.SetFont("MyFont")
- if (HP <= 100 and HP > 75) then
- surface.SetMaterial(health100)
- else if (HP == 75 and HP > 50) then
- surface.SetMaterial(health75)
- else if (HP == 50 and HP > 25) then
- surface.SetMaterial(health50)
- else if (HP == 25 and HP > 0) then
- surface.SetMaterial(health25)
- else if (HP == 0) then
- surface.SetMaterial(health0)
- end
- end
- end
- end
- end
- surface.SetDrawColor( 255, 255, 255, 255 )
- surface.DrawTexturedRect( 25, ScrH() - 220, 34, 50 )
- surface.DrawText( "\n\n\nHealth:" )
- surface.SetTextColor( Color(0, 204, 204, 255))
- surface.DrawText( HP )
- --//HEALTH\\--
- end
- hook.Add("Tick", "Player dies if food or water = 100", function()
- if ( !IsValid( LocalPlayer() ) ) then return end
- if (LocalPlayer():GetNWFloat('water') <= 105 and LocalPlayer():GetNWFloat('water') >= 99) then
- LocalPlayer():ChatPrint("You died from hunger! Get food quick!")
- LocalPlayer():Kill()
- LocalPlayer():SetNWFloat('water', 50) -- Means that players dont suicide just to reset food & water.
- LocalPlayer():SetNWFloat('food', 50)
- end
- if (LocalPlayer():GetNWFloat('food') <= 110 and LocalPlayer():GetNWFloat('food') >= 99) then
- LocalPlayer():ChatPrint("You died from thirst! Get water quick!")
- LocalPlayer():Kill()
- LocalPlayer():SetNWFloat('water', 50) -- Means that players dont suicide just to reset food & water.
- LocalPlayer():SetNWFloat('food', 50)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement