Advertisement
Guest User

Untitled

a guest
Jun 26th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.44 KB | None | 0 0
  1. include ('shared.lua')
  2.  
  3. surface.CreateFont( "MyFont", {
  4. font = "Arial",
  5. size = 20,
  6. weight = 500,
  7. blursize = 0,
  8. scanlines = 0,
  9. antialias = true,
  10. underline = false,
  11. italic = false,
  12. strikeout = false,
  13. symbol = false,
  14. rotary = false,
  15. shadow = false,
  16. additive = false,
  17. outline = false,
  18. } )
  19.  
  20. function HUDHide( myhud )
  21. for k, v in pairs{"CHudHealth", "CHudCrosshair"} do
  22. if (myhud == v) then
  23. return false
  24. end
  25. end
  26. end
  27. hook.Add("HUDShouldDraw","HUDHide",HUDHide)
  28.  
  29. function GM:HUDPaint()
  30. local hunger100 = Material('gamemodes/LG/content/images/food 100.png')
  31. local hunger75 = Material('gamemodes/LG/content/images/food 75.png')
  32. local hunger50 = Material('gamemodes/LG/content/images/food 50.png')
  33. local hunger25 = Material('gamemodes/LG/content/images/food 25.png')
  34. local hunger0 = Material('gamemodes/LG/content/images/food 0.png')
  35.  
  36. local thirst100 = Material('gamemodes/LG/content/images/drink 100.png')
  37. local thirst75 = Material('gamemodes/LG/content/images/drink 75.png')
  38. local thirst50 = Material('gamemodes/LG/content/images/drink 50.png')
  39. local thirst25 = Material('gamemodes/LG/content/images/drink 25.png')
  40. local thirst0 = Material('gamemodes/LG/content/images/drink 0.png')
  41.  
  42. local health100 = Material('gamemodes/LG/content/images/health 100.png')
  43. local health75 = Material('gamemodes/LG/content/images/health 75.png')
  44. local health50 = Material('gamemodes/LG/content/images/health 50.png')
  45. local health25 = Material('gamemodes/LG/content/images/health 25.png')
  46. local health0 = Material('gamemodes/LG/content/images/health 0.png')
  47.  
  48. local coin = Material('gamemodes/LG/content/images/coin.png')
  49. self.BaseClass:HUDPaint()
  50. draw.RoundedBox( 14, 25, ScrH() - 280, 400, 260, Color( 0,0,0 ))
  51. local HP = LocalPlayer():Health()
  52. local food = LocalPlayer():GetNWFloat('food')
  53. local water = LocalPlayer():GetNWFloat('water')
  54. local cash = LocalPlayer():GetNWFloat('money')
  55.  
  56. if (string.len(LocalPlayer():GetName()) <= 35) then
  57. user = LocalPlayer():GetName()
  58. else
  59. user = "Username too long!"
  60. end
  61.  
  62. --//MONEY\\--
  63. surface.SetTextColor( 255, 255, 250, 255 )
  64. surface.SetTextPos( 25, ScrH() - 50 )
  65. surface.SetFont("MyFont")
  66. surface.SetMaterial(coin)
  67. surface.SetDrawColor( 255, 255, 255, 255 )
  68. surface.DrawTexturedRect( 25, ScrH() - 70, 34, 50 )
  69. surface.DrawText( "\n\n\nCash:" )
  70. surface.SetTextColor( Color(0, 204, 204, 255))
  71. surface.DrawText( cash )
  72. --//MONEY\\--
  73.  
  74. --//HUNGER\\--
  75. surface.SetTextColor( 255, 255, 250, 255 )
  76. surface.SetTextPos( 25, ScrH() - 100 )
  77. surface.SetFont("MyFont")
  78. surface.SetDrawColor( 255, 255, 255, 255 )
  79. if (food <= 100 and food > 75) then
  80. surface.SetMaterial(hunger100)
  81. else if (food == 75 and food > 50) then
  82. surface.SetMaterial(hunger75)
  83. else if (food == 50 and food > 25) then
  84. surface.SetMaterial(hunger50)
  85. else if (food == 25 and food > 0) then
  86. surface.SetMaterial(hunger25)
  87. else if (food == 0) then
  88. surface.SetMaterial(hunger0)
  89. end
  90. end
  91. end
  92. end
  93. end
  94. surface.DrawTexturedRect( 25, ScrH() - 120, 34, 50 )
  95. surface.DrawText( "\n\n\nHunger:" )
  96. surface.SetTextColor( Color(0, 204, 204, 255))
  97. surface.DrawText( food )
  98. --//HUNGER\\--
  99.  
  100. --//WATER\\--
  101. surface.SetTextColor( 255, 255, 250, 255 )
  102. surface.SetTextPos( 25, ScrH() - 150 )
  103. surface.SetFont("MyFont")
  104. if (water <= 100 and water > 75) then
  105. surface.SetMaterial(thirst100)
  106. else if (water == 75 and water > 50) then
  107. surface.SetMaterial(thirst75)
  108. else if (water == 50 and water > 25) then
  109. surface.SetMaterial(thirst50)
  110. else if (water == 25 and water > 0) then
  111. surface.SetMaterial(thirst25)
  112. else if (water == 0) then
  113. surface.SetMaterial(thirst0)
  114. end
  115. end
  116. end
  117. end
  118. end
  119. surface.SetDrawColor( 255, 255, 255, 255 )
  120. surface.DrawTexturedRect( 25, ScrH() - 170, 34, 50 )
  121. surface.DrawText( "\n\n\nThirst:" )
  122. surface.SetTextColor( Color(0, 204, 204, 255))
  123. surface.DrawText( water )
  124. --//WATER\\--
  125.  
  126. --//HEALTH\\--
  127. surface.SetTextColor( 255, 255, 250, 255 )
  128. surface.SetTextPos( 25, ScrH() - 200 )
  129. surface.SetFont("MyFont")
  130. if (HP <= 100 and HP > 75) then
  131. surface.SetMaterial(health100)
  132. else if (HP == 75 and HP > 50) then
  133. surface.SetMaterial(health75)
  134. else if (HP == 50 and HP > 25) then
  135. surface.SetMaterial(health50)
  136. else if (HP == 25 and HP > 0) then
  137. surface.SetMaterial(health25)
  138. else if (HP == 0) then
  139. surface.SetMaterial(health0)
  140. end
  141. end
  142. end
  143. end
  144. end
  145. surface.SetDrawColor( 255, 255, 255, 255 )
  146. surface.DrawTexturedRect( 25, ScrH() - 220, 34, 50 )
  147. surface.DrawText( "\n\n\nHealth:" )
  148. surface.SetTextColor( Color(0, 204, 204, 255))
  149. surface.DrawText( HP )
  150. --//HEALTH\\--
  151. end
  152.  
  153. hook.Add("Tick", "Player dies if food or water = 100", function()
  154. if ( !IsValid( LocalPlayer() ) ) then return end
  155. if (LocalPlayer():GetNWFloat('water') <= 105 and LocalPlayer():GetNWFloat('water') >= 99) then
  156. LocalPlayer():ChatPrint("You died from hunger! Get food quick!")
  157. LocalPlayer():Kill()
  158. LocalPlayer():SetNWFloat('water', 50) -- Means that players dont suicide just to reset food & water.
  159. LocalPlayer():SetNWFloat('food', 50)
  160. end
  161. if (LocalPlayer():GetNWFloat('food') <= 110 and LocalPlayer():GetNWFloat('food') >= 99) then
  162. LocalPlayer():ChatPrint("You died from thirst! Get water quick!")
  163. LocalPlayer():Kill()
  164. LocalPlayer():SetNWFloat('water', 50) -- Means that players dont suicide just to reset food & water.
  165. LocalPlayer():SetNWFloat('food', 50)
  166. end
  167.  
  168. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement