Advertisement
Guest User

Untitled

a guest
Mar 1st, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.76 KB | None | 0 0
  1. function hidehud(name)
  2. for k, v in pairs({"CHudHealth", "CHudBattery"}) do
  3. if name == v then return false end
  4. end
  5. end
  6. hook.Add("HUDShouldDraw", "HideOurHud:D", hidehud)
  7.  
  8.  
  9.  
  10. surface.CreateFont("ello_font", { font = "Arial", size = 20, weight = 800 } )
  11.  
  12.  
  13. local function Base()
  14.  
  15.  
  16. local ply = LocalPlayer()
  17.  
  18. local DrawHealth = LocalPlayer():Health()
  19. local DrawArmor = LocalPlayer():Armor()
  20.  
  21. if DrawHealth > 100 then DrawHealth = 100 end
  22. if DrawHealth < 0 then DrawHealth = 0 end
  23.  
  24. if DrawArmor > 100 then DrawArmor = 100 end
  25. if DrawArmor < 0 then DrawArmor = 0 end
  26.  
  27.  
  28.  
  29. --If the variables table has not be initialized, initialize it
  30. LocalPlayer().DarkRPVars = LocalPlayer().DarkRPVars or {}
  31.  
  32. --If the money is not set, don't do anything
  33. local v1 = LocalPlayer().DarkRPVars.money
  34. if not v1 then v1 = "" end
  35.  
  36. --If the salary is not set, don't do anything
  37. local v2 = LocalPlayer().DarkRPVars.salary
  38. if not v2 then v2 = "" end
  39.  
  40.  
  41.  
  42.  
  43.  
  44. draw.RoundedBox(6, (ScrW() / 15) -101 , ScrH() -45 , 570, 50, Color(40, 40, 40) )
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52. draw.RoundedBox(6, (ScrW() / 15) -101 , ScrH() -124 -10 , 210, 100, Color(40, 40, 40, 225) )
  53.  
  54. draw.RoundedBox(2, (ScrW() / 15) -9.17 , ScrH() -37, 200-15, 30, Color(100, 100, 100) )
  55. draw.RoundedBox(0, (ScrW() / 15) -8, ScrH() -35, 200-20 , 30 - 4, Color(0,0,0) )
  56. if DrawHealth != 0 then
  57. draw.RoundedBox(0, (ScrW() / 15) -8, ScrH() -35, (200-20) * DrawHealth / 100 , 30 - 4, Color(255, 128, 0) )
  58.  
  59. end
  60.  
  61.  
  62.  
  63.  
  64. draw.RoundedBox(2, (ScrW() / 15) -101 , ScrH() -134, 210, 3, Color(255, 128, 0) )
  65. draw.RoundedBox(2, (ScrW() / 15) -101 , ScrH() -45, 570, 3, Color(255, 128, 0) )
  66.  
  67. draw.SimpleText("$" .. v1,'ello_font',(ScrW() / 15) -22,ScrH() - 105, Color(255, 128, 0))
  68. draw.SimpleText("Wallet", 'ello_font', (ScrW() / 15) -88, ScrH() - 105, Color(255, 128, 0) )
  69. draw.SimpleText("$" .. v2,'ello_font',(ScrW() / 15) -22,ScrH() - 85, Color(255, 128, 0) )
  70. draw.SimpleText("Salary", 'ello_font', (ScrW() / 15) -88, ScrH() - 85, Color(255, 128, 0) )
  71. draw.SimpleText(LocalPlayer().DarkRPVars.job,'ello_font',(ScrW() / 15) -22, ScrH() -65, Color(255, 128, 0))
  72. draw.SimpleText("Job", 'ello_font', (ScrW() / 15) -88, ScrH() - 65, Color(255, 128, 0) )
  73.  
  74.  
  75. draw.SimpleText( "" .. ply:Nick(), 'ello_font', (ScrW() / 15) -90, ScrH() -130, Color(255, 128, 0) )
  76. draw.SimpleText("Health", 'ello_font',(ScrW() / 15) -85, ScrH() -35, Color(255, 128, 0) )
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83. draw.RoundedBox(2,(ScrW() / 15) + 270, ScrH() -37, 200-15, 30, Color(100, 100, 100) )
  84. draw.RoundedBox(0,(ScrW() / 15) + 272, ScrH() -35, (200-20) , 30 - 4, Color(0, 0, 0) )
  85. if DrawArmor != 0 then
  86. draw.RoundedBox(0,(ScrW() / 15) + 272, ScrH() -35, (200-20) * DrawArmor / 100 , 30 - 4, Color(255, 128, 0) )
  87. end
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103. draw.RoundedBox(2, (ScrW() / 15) + 172 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  104. draw.RoundedBox(2, (ScrW() / 15) + 169 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  105. draw.RoundedBox(2, (ScrW() / 15) + 166 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  106. draw.RoundedBox(2, (ScrW() / 15) + 163 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  107. draw.RoundedBox(2, (ScrW() / 15) + 160 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  108. draw.RoundedBox(2, (ScrW() / 15) + 157 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  109. draw.RoundedBox(2, (ScrW() / 15) + 154 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  110. draw.RoundedBox(2, (ScrW() / 15) + 151 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  111. draw.RoundedBox(2, (ScrW() / 15) + 148 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  112. draw.RoundedBox(2, (ScrW() / 15) + 145 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  113. draw.RoundedBox(2, (ScrW() / 15) + 142 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  114. draw.RoundedBox(2, (ScrW() / 15) + 139 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  115. draw.RoundedBox(2, (ScrW() / 15) + 136 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  116. draw.RoundedBox(2, (ScrW() / 15) + 133 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  117. draw.RoundedBox(2, (ScrW() / 15) + 130 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  118. draw.RoundedBox(2, (ScrW() / 15) + 127 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  119. draw.RoundedBox(2, (ScrW() / 15) + 124 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  120. draw.RoundedBox(2, (ScrW() / 15) + 121 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  121. draw.RoundedBox(2, (ScrW() / 15) + 118 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  122. draw.RoundedBox(2, (ScrW() / 15) + 115 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  123. draw.RoundedBox(2, (ScrW() / 15) + 112 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  124. draw.RoundedBox(2, (ScrW() / 15) + 109 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  125. draw.RoundedBox(2, (ScrW() / 15) + 106 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  126. draw.RoundedBox(2, (ScrW() / 15) + 103 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  127. draw.RoundedBox(2, (ScrW() / 15) + 100 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  128. draw.RoundedBox(2, (ScrW() / 15) + 97 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  129. draw.RoundedBox(2, (ScrW() / 15) + 94 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  130. draw.RoundedBox(2, (ScrW() / 15) + 91 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  131. draw.RoundedBox(2, (ScrW() / 15) + 88 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  132. draw.RoundedBox(2, (ScrW() / 15) + 85 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  133. draw.RoundedBox(2, (ScrW() / 15) + 82 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  134. draw.RoundedBox(2, (ScrW() / 15) + 79 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  135. draw.RoundedBox(2,(ScrW() / 15) + 76 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  136. draw.RoundedBox(2, (ScrW() / 15) + 73 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  137. draw.RoundedBox(2, (ScrW() / 15) + 70 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  138. draw.RoundedBox(2, (ScrW() / 15) + 67 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  139. draw.RoundedBox(2, (ScrW() / 15) + 64 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  140. draw.RoundedBox(2, (ScrW() / 15) + 61 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  141. draw.RoundedBox(2, (ScrW() / 15) + 58 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  142. draw.RoundedBox(2, (ScrW() / 15) + 55 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  143. draw.RoundedBox(2, (ScrW() / 15) + 52 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  144. draw.RoundedBox(2, (ScrW() / 15) + 49 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  145. draw.RoundedBox(2, (ScrW() / 15) + 46 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  146. draw.RoundedBox(2, (ScrW() / 15) + 43 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  147. draw.RoundedBox(2, (ScrW() / 15) + 40 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  148. draw.RoundedBox(2, (ScrW() / 15) + 37 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  149. draw.RoundedBox(2, (ScrW() / 15) + 34 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  150. draw.RoundedBox(2, (ScrW() / 15) + 31 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  151. draw.RoundedBox(2, (ScrW() / 15) + 28 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  152. draw.RoundedBox(2, (ScrW() / 15) + 25 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  153. draw.RoundedBox(2, (ScrW() / 15) + 22 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  154. draw.RoundedBox(2, (ScrW() / 15) + 19 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  155. draw.RoundedBox(2, (ScrW() / 15) + 16 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  156. draw.RoundedBox(2, (ScrW() / 15)+ 13 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  157. draw.RoundedBox(2, (ScrW() / 15) +10 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  158. draw.RoundedBox(2, (ScrW() / 15)+ 7 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  159. draw.RoundedBox(2, (ScrW() / 15) + 4 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  160. draw.RoundedBox(2, (ScrW() / 15) + 1 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  161. draw.RoundedBox(2, (ScrW() / 15) -2 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  162. draw.RoundedBox(2, (ScrW() / 15) -5 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  163. draw.RoundedBox(2, (ScrW() / 15) -8, ScrH() -35, 1.5, 26, Color(0,0,0) )
  164.  
  165. draw.RoundedBox(2, (ScrW() / 15) + 452 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  166. draw.RoundedBox(2, (ScrW() / 15) + 449 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  167. draw.RoundedBox(2, (ScrW() / 15) + 446 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  168. draw.RoundedBox(2, (ScrW() / 15) + 443 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  169. draw.RoundedBox(2, (ScrW() / 15) + 440 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  170. draw.RoundedBox(2, (ScrW() / 15) + 437 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  171. draw.RoundedBox(2, (ScrW() / 15) + 434 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  172. draw.RoundedBox(2, (ScrW() / 15) + 431 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  173. draw.RoundedBox(2, (ScrW() / 15) + 428 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  174. draw.RoundedBox(2, (ScrW() / 15) + 425 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  175. draw.RoundedBox(2, (ScrW() / 15) + 422 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  176. draw.RoundedBox(2, (ScrW() / 15) + 419 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  177. draw.RoundedBox(2, (ScrW() / 15) + 416 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  178. draw.RoundedBox(2, (ScrW() / 15) + 413 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  179. draw.RoundedBox(2, (ScrW() / 15) + 410 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  180. draw.RoundedBox(2, (ScrW() / 15) + 407 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  181. draw.RoundedBox(2, (ScrW() / 15) + 404 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  182. draw.RoundedBox(2, (ScrW() / 15) + 401 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  183. draw.RoundedBox(2, (ScrW() / 15) + 398 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  184. draw.RoundedBox(2, (ScrW() / 15) + 395 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  185. draw.RoundedBox(2, (ScrW() / 15) + 392 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  186. draw.RoundedBox(2, (ScrW() / 15) + 389 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  187. draw.RoundedBox(2, (ScrW() / 15) + 386 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  188. draw.RoundedBox(2, (ScrW() / 15) + 383 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  189. draw.RoundedBox(2, (ScrW() / 15) + 380 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  190. draw.RoundedBox(2, (ScrW() / 15) + 377 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  191. draw.RoundedBox(2, (ScrW() / 15) + 374 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  192. draw.RoundedBox(2, (ScrW() / 15) + 371 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  193. draw.RoundedBox(2, (ScrW() / 15) + 368 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  194. draw.RoundedBox(2, (ScrW() / 15) + 365 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  195. draw.RoundedBox(2, (ScrW() / 15) + 362 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  196. draw.RoundedBox(2, (ScrW() / 15) + 359 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  197. draw.RoundedBox(2, (ScrW() / 15) + 356 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  198. draw.RoundedBox(2, (ScrW() / 15) + 353 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  199. draw.RoundedBox(2, (ScrW() / 15) + 350 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  200. draw.RoundedBox(2, (ScrW() / 15) + 347 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  201. draw.RoundedBox(2, (ScrW() / 15) + 344 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  202. draw.RoundedBox(2, (ScrW() / 15) + 341 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  203. draw.RoundedBox(2, (ScrW() / 15) + 338 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  204. draw.RoundedBox(2, (ScrW() / 15) + 335 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  205. draw.RoundedBox(2, (ScrW() / 15) + 332 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  206. draw.RoundedBox(2, (ScrW() / 15) + 329 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  207. draw.RoundedBox(2, (ScrW() / 15) + 326 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  208. draw.RoundedBox(2, (ScrW() / 15) + 323 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  209. draw.RoundedBox(2, (ScrW() / 15) + 320 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  210. draw.RoundedBox(2, (ScrW() / 15) + 317 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  211. draw.RoundedBox(2, (ScrW() / 15) + 314 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  212. draw.RoundedBox(2, (ScrW() / 15) + 311 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  213. draw.RoundedBox(2, (ScrW() / 15) + 308 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  214. draw.RoundedBox(2, (ScrW() / 15) + 305 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  215. draw.RoundedBox(2, (ScrW() / 15) + 302, ScrH() -35, 1.5, 26, Color(0,0,0) )
  216. draw.RoundedBox(2, (ScrW() / 15) + 299, ScrH() -35, 1.5, 26, Color(0,0,0) )
  217. draw.RoundedBox(2, (ScrW() / 15) + 296, ScrH() -35, 1.5, 26, Color(0,0,0) )
  218. draw.RoundedBox(2, (ScrW() / 15) +293 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  219. draw.RoundedBox(2, (ScrW() / 15) +290 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  220. draw.RoundedBox(2, (ScrW() / 15) +287 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  221. draw.RoundedBox(2, (ScrW() / 15) +284 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  222. draw.RoundedBox(2, (ScrW() / 15) +281 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  223. draw.RoundedBox(2, (ScrW() / 15) +278 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  224. draw.RoundedBox(2, (ScrW() / 15) +275 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  225. draw.RoundedBox(2, (ScrW() / 15) +272 , ScrH() -35, 1.5, 26, Color(0,0,0) )
  226.  
  227.  
  228. draw.SimpleText("Armor", 'ello_font',(ScrW() / 15) + 195, ScrH() -35, Color(255, 128, 0) )
  229. draw.SimpleText("/100", 'ello_font',(ScrW() / 15) + 400, ScrH() -35, Color(255,255,255) )
  230.  
  231.  
  232.  
  233. surface.SetFont( "ello_font")
  234. surface.SetTextColor(Color(255,255,255))
  235. surface.SetTextPos((ScrW() / 15) + 360,ScrH() -35)
  236. surface.DrawText("" .. ply:Armor() .. "")
  237.  
  238.  
  239.  
  240. surface.SetFont( "ello_font")
  241. surface.SetTextColor(Color(255,255,255))
  242. surface.SetTextPos((ScrW() / 15) + 85,ScrH() -35)
  243. surface.DrawText("" .. ply:Health() .. "")
  244.  
  245. draw.SimpleText("/100", 'ello_font', (ScrW() / 15) + 125,ScrH() -35, Color(255,255,255) )
  246.  
  247. end
  248.  
  249.  
  250. /*---------------------------------------------------------------------------
  251. HUD ConVars
  252. ---------------------------------------------------------------------------*/
  253. local ConVars = {}
  254. local HUDWidth
  255. local HUDHeight
  256.  
  257. local Color = Color
  258. local cvars = cvars
  259. local DarkRP = DarkRP
  260. local CurTime = CurTime
  261. local draw = draw
  262. local GetConVar = GetConVar
  263. local IsValid = IsValid
  264. local Lerp = Lerp
  265. local localplayer
  266. local math = math
  267. local pairs = pairs
  268. local ScrW, ScrH = ScrW, ScrH
  269. local SortedPairs = SortedPairs
  270. local string = string
  271. local surface = surface
  272. local table = table
  273. local timer = timer
  274. local tostring = tostring
  275.  
  276. CreateClientConVar("weaponhud", 0, true, false)
  277.  
  278. local colors = {}
  279. colors.black = Color(0, 0, 0, 255)
  280. colors.blue = Color(0, 0, 255, 255)
  281. colors.brightred = Color(200, 30, 30, 255)
  282. colors.darkred = Color(0, 0, 70, 100)
  283. colors.darkblack = Color(0, 0, 0, 200)
  284. colors.gray1 = Color(0, 0, 0, 155)
  285. colors.gray2 = Color(51, 58, 51,100)
  286. colors.red = Color(255, 0, 0, 255)
  287. colors.white = Color(255, 255, 255, 255)
  288. colors.white1 = Color(255, 255, 255, 200)
  289.  
  290. local function ReloadConVars()
  291. ConVars = {
  292. background = {0,0,0,100},
  293. Healthbackground = {0,0,0,200},
  294. Healthforeground = {140,0,0,180},
  295. HealthText = {255,255,255,200},
  296. Job1 = {0,0,150,200},
  297. Job2 = {0,0,0,255},
  298. salary1 = {0,150,0,200},
  299. salary2 = {0,0,0,255}
  300. }
  301.  
  302. for name, Colour in pairs(ConVars) do
  303. ConVars[name] = {}
  304. for num, rgb in SortedPairs(Colour) do
  305. local CVar = GetConVar(name..num) or CreateClientConVar(name..num, rgb, true, false)
  306. table.insert(ConVars[name], CVar:GetInt())
  307.  
  308. if not cvars.GetConVarCallbacks(name..num, false) then
  309. cvars.AddChangeCallback(name..num, function() timer.Simple(0,ReloadConVars) end)
  310. end
  311. end
  312. ConVars[name] = Color(unpack(ConVars[name]))
  313. end
  314.  
  315.  
  316. HUDWidth = (GetConVar("HudW") or CreateClientConVar("HudW", 240, true, false)):GetInt()
  317. HUDHeight = (GetConVar("HudH") or CreateClientConVar("HudH", 115, true, false)):GetInt()
  318.  
  319. if not cvars.GetConVarCallbacks("HudW", false) and not cvars.GetConVarCallbacks("HudH", false) then
  320. cvars.AddChangeCallback("HudW", function() timer.Simple(0,ReloadConVars) end)
  321. cvars.AddChangeCallback("HudH", function() timer.Simple(0,ReloadConVars) end)
  322. end
  323. end
  324. ReloadConVars()
  325.  
  326. local Scrw, Scrh, RelativeX, RelativeY
  327. /*---------------------------------------------------------------------------
  328. HUD Seperate Elements
  329. ---------------------------------------------------------------------------*/
  330.  
  331. local Page = Material("icon16/page_white_text.png")
  332. local function GunLicense()
  333. if localplayer:getDarkRPVar("HasGunlicense") then
  334. surface.SetMaterial(Page)
  335. surface.SetDrawColor(255, 255, 255, 255)
  336. surface.DrawTexturedRect(RelativeX + HUDWidth, ScrH() - 34, 32, 32)
  337. end
  338. end
  339.  
  340. local function Agenda()
  341. local ply = LocalPlayer()
  342.  
  343. local agenda = ply:getAgendaTable()
  344. if not agenda then return end
  345.  
  346. draw.RoundedBox(10, 10, 10, 460, 110, colors.gray1)
  347. draw.RoundedBox(10, 12, 12, 456, 106, colors.gray2)
  348. draw.RoundedBox(10, 12, 12, 456, 20, colors.darkred)
  349.  
  350. draw.DrawNonParsedText(agenda.Title, "DarkRPHUD1", 30, 12, colors.red, 0)
  351.  
  352. local text = ply:getDarkRPVar("agenda") or ""
  353.  
  354. text = text:gsub("//", "\n"):gsub("\\n", "\n")
  355. text = DarkRP.textWrap(text, "DarkRPHUD1", 440)
  356. draw.DrawNonParsedText(text, "DarkRPHUD1", 30, 35, colors.white, 0)
  357. end
  358.  
  359. local VoiceChatTexture = surface.GetTextureID("voice/icntlk_pl")
  360. local function DrawVoiceChat()
  361. if localplayer.DRPIsTalking then
  362. local chbxX, chboxY = chat.GetChatBoxPos()
  363.  
  364. local Rotating = math.sin(CurTime()*3)
  365. local backwards = 0
  366. if Rotating < 0 then
  367. Rotating = 1-(1+Rotating)
  368. backwards = 180
  369. end
  370. surface.SetTexture(VoiceChatTexture)
  371. surface.SetDrawColor(ConVars.Healthforeground)
  372. surface.DrawTexturedRectRotated(ScrW() - 100, chboxY, Rotating*96, 96, backwards)
  373. end
  374. end
  375.  
  376. CreateConVar("DarkRP_LockDown", 0, {FCVAR_REPLICATED, FCVAR_SERVER_CAN_EXECUTE})
  377. local function LockDown()
  378. local chbxX, chboxY = chat.GetChatBoxPos()
  379. if util.tobool(GetConVarNumber("DarkRP_LockDown")) then
  380. local cin = (math.sin(CurTime()) + 1) / 2
  381. local chatBoxSize = math.floor(ScrH() / 4)
  382. draw.DrawNonParsedText(DarkRP.getPhrase("lockdown_started"), "ScoreboardSubtitle", chbxX, chboxY + chatBoxSize, Color(cin * 255, 0, 255 - (cin * 255), 255), TEXT_ALIGN_LEFT)
  383. end
  384. end
  385.  
  386. local Arrested = function() end
  387.  
  388. usermessage.Hook("GotArrested", function(msg)
  389. local StartArrested = CurTime()
  390. local ArrestedUntil = msg:ReadFloat()
  391.  
  392. Arrested = function()
  393. if CurTime() - StartArrested <= ArrestedUntil and localplayer:getDarkRPVar("Arrested") then
  394. draw.DrawNonParsedText(DarkRP.getPhrase("youre_arrested", math.ceil(ArrestedUntil - (CurTime() - StartArrested))), "DarkRPHUD1", ScrW()/2, ScrH() - ScrH()/12, colors.white, 1)
  395. elseif not localplayer:getDarkRPVar("Arrested") then
  396. Arrested = function() end
  397. end
  398. end
  399. end)
  400.  
  401. local AdminTell = function() end
  402.  
  403. usermessage.Hook("AdminTell", function(msg)
  404. timer.Destroy("DarkRP_AdminTell")
  405. local Message = msg:ReadString()
  406.  
  407. AdminTell = function()
  408. draw.RoundedBox(4, 10, 10, ScrW() - 20, 100, colors.darkblack)
  409. draw.DrawNonParsedText(DarkRP.getPhrase("listen_up"), "GModToolName", ScrW() / 2 + 10, 10, colors.white, 1)
  410. draw.DrawNonParsedText(Message, "ChatFont", ScrW() / 2 + 10, 80, colors.brightred, 1)
  411. end
  412.  
  413. timer.Create("DarkRP_AdminTell", 10, 1, function()
  414. AdminTell = function() end
  415. end)
  416. end)
  417.  
  418. /*---------------------------------------------------------------------------
  419. Entity HUDPaint things
  420. ---------------------------------------------------------------------------*/
  421. local function DrawPlayerInfo(ply)
  422. local pos = ply:EyePos()
  423.  
  424. pos.z = pos.z + 10 -- The position we want is a bit above the position of the eyes
  425. pos = pos:ToScreen()
  426. pos.y = pos.y - 50 -- Move the text up a few pixels to compensate for the height of the text
  427.  
  428. if GAMEMODE.Config.showname and not ply:getDarkRPVar("wanted") then
  429. draw.DrawNonParsedText(ply:Nick(), "DarkRPHUD2", pos.x + 1, pos.y + 1, colors.black, 1)
  430. draw.DrawNonParsedText(ply:Nick(), "DarkRPHUD2", pos.x, pos.y, team.GetColor(ply:Team()), 1)
  431. end
  432.  
  433. if GAMEMODE.Config.showhealth and not ply:getDarkRPVar("wanted") then
  434. draw.DrawNonParsedText(DarkRP.getPhrase("health", ply:Health()), "DarkRPHUD2", pos.x + 1, pos.y + 21, colors.black, 1)
  435. draw.DrawNonParsedText(DarkRP.getPhrase("health", ply:Health()), "DarkRPHUD2", pos.x, pos.y + 20, colors.white1, 1)
  436. end
  437.  
  438. if GAMEMODE.Config.showjob then
  439. local teamname = team.GetName(ply:Team())
  440. draw.DrawNonParsedText(ply:getDarkRPVar("job") or teamname, "DarkRPHUD2", pos.x + 1, pos.y + 41, colors.black, 1)
  441. draw.DrawNonParsedText(ply:getDarkRPVar("job") or teamname, "DarkRPHUD2", pos.x, pos.y + 40, colors.white1, 1)
  442. end
  443.  
  444. if ply:getDarkRPVar("HasGunlicense") then
  445. surface.SetMaterial(Page)
  446. surface.SetDrawColor(255,255,255,255)
  447. surface.DrawTexturedRect(pos.x-16, pos.y + 60, 32, 32)
  448. end
  449. end
  450.  
  451. local function DrawWantedInfo(ply)
  452. if not ply:Alive() then return end
  453.  
  454. local pos = ply:EyePos()
  455. if not pos:isInSight({localplayer, ply}) then return end
  456.  
  457. pos.z = pos.z + 14
  458. pos = pos:ToScreen()
  459.  
  460. if GAMEMODE.Config.showname then
  461. draw.DrawNonParsedText(ply:Nick(), "DarkRPHUD2", pos.x + 1, pos.y + 1, colors.black, 1)
  462. draw.DrawNonParsedText(ply:Nick(), "DarkRPHUD2", pos.x, pos.y, team.GetColor(ply:Team()), 1)
  463. end
  464.  
  465. local wantedText = DarkRP.getPhrase("wanted", tostring(ply:getDarkRPVar("wantedReason")))
  466.  
  467. draw.DrawNonParsedText(wantedText, "DarkRPHUD2", pos.x, pos.y - 40, colors.white1, 1)
  468. draw.DrawNonParsedText(wantedText, "DarkRPHUD2", pos.x + 1, pos.y - 41, colors.red, 1)
  469. end
  470.  
  471. /*---------------------------------------------------------------------------
  472. The Entity display: draw HUD information about entities
  473. ---------------------------------------------------------------------------*/
  474. local function DrawEntityDisplay()
  475.  
  476. local shootPos = localplayer:GetShootPos()
  477. local aimVec = localplayer:GetAimVector()
  478.  
  479. for k, ply in pairs(players or player.GetAll()) do
  480. if not ply:Alive() or ply == localplayer then continue end
  481. local hisPos = ply:GetShootPos()
  482. if ply:getDarkRPVar("wanted") then DrawWantedInfo(ply) end
  483.  
  484. if GAMEMODE.Config.globalshow then
  485. DrawPlayerInfo(ply)
  486. -- Draw when you're (almost) looking at him
  487. elseif not GAMEMODE.Config.globalshow and hisPos:DistToSqr(shootPos) < 160000 then
  488. local pos = hisPos - shootPos
  489. local unitPos = pos:GetNormalized()
  490. if unitPos:Dot(aimVec) > 0.95 then
  491. local trace = util.QuickTrace(shootPos, pos, localplayer)
  492. if trace.Hit and trace.Entity ~= ply then return end
  493. DrawPlayerInfo(ply)
  494. end
  495. end
  496. end
  497.  
  498. local tr = localplayer:GetEyeTrace()
  499.  
  500. if IsValid(tr.Entity) and tr.Entity:isKeysOwnable() and tr.Entity:GetPos():Distance(localplayer:GetPos()) < 200 then
  501. tr.Entity:drawOwnableInfo()
  502. end
  503. end
  504.  
  505. /*---------------------------------------------------------------------------
  506. Drawing death notices
  507. ---------------------------------------------------------------------------*/
  508. function GAMEMODE:DrawDeathNotice(x, y)
  509. if not GAMEMODE.Config.showdeaths then return end
  510. self.BaseClass:DrawDeathNotice(x, y)
  511. end
  512.  
  513. /*---------------------------------------------------------------------------
  514. Display notifications
  515. ---------------------------------------------------------------------------*/
  516. local function DisplayNotify(msg)
  517. local txt = msg:ReadString()
  518. GAMEMODE:AddNotify(txt, msg:ReadShort(), msg:ReadLong())
  519. surface.PlaySound("buttons/lightswitch2.wav")
  520.  
  521. -- Log to client console
  522. print(txt)
  523. end
  524. usermessage.Hook("_Notify", DisplayNotify)
  525.  
  526. /*---------------------------------------------------------------------------
  527. Remove some elements from the HUD in favour of the DarkRP HUD
  528. ---------------------------------------------------------------------------*/
  529. function GAMEMODE:HUDShouldDraw(name)
  530. if name == "CHudHealth" or
  531. name == "CHudBattery" or
  532. name == "CHudSuitPower" or
  533. (HelpToggled and name == "CHudChat") then
  534. return false
  535. else
  536. return true
  537. end
  538. end
  539.  
  540. /*---------------------------------------------------------------------------
  541. Disable players' names popping up when looking at them
  542. ---------------------------------------------------------------------------*/
  543. function GAMEMODE:HUDDrawTargetID()
  544. return false
  545. end
  546.  
  547. /*---------------------------------------------------------------------------
  548. Actual HUDPaint hook
  549. ---------------------------------------------------------------------------*/
  550. function DrawHUD()
  551. localplayer = localplayer and IsValid(localplayer) and localplayer or LocalPlayer()
  552. if not IsValid(localplayer) then return end
  553.  
  554. -- Custom
  555. Base()
  556.  
  557. -- Default
  558. GunLicense()
  559. Agenda()
  560. DrawVoiceChat()
  561. LockDown()
  562. Arrested()
  563. AdminTell()
  564. DrawEntityDisplay()
  565.  
  566. end
  567. hook.Add("HUDPaint", "DrawHUD", DrawHUD)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement