Advertisement
Espinete87

Untitled

Oct 15th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.55 KB | None | 0 0
  1. if GetConVarNumber( "hat_enable" )==1 then
  2. surface.CreateFont( "Whatever", {
  3. font = "Arial",
  4. extended = false,
  5. size = 13,
  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. local cTimeT=CurTime() + 25
  21. local cTimeH=CurTime() + 40
  22. local cTimeR=CurTime() + 5
  23. local cur_hat_h = GetConVarNumber( "hat_max_hunger_amount" )
  24. local cur_hat_t = GetConVarNumber( "hat_max_thirst_amount" )
  25.  
  26. local function setHATHP()
  27. net.Start("setHatHP")
  28. net.SendToServer()
  29. end
  30.  
  31. net.Receive("hat_water_bk",function( len, pl )
  32. cur_hat_t = cur_hat_t + 12
  33. end)
  34.  
  35. net.Receive("hat_takeout_bk",function( len, pl )
  36. cur_hat_h = cur_hat_h + 9
  37. end)
  38.  
  39. net.Receive("hat_bread_bk",function( len, pl )
  40. cur_hat_h = cur_hat_h + 13
  41. end)
  42.  
  43. net.Receive("hat_beer_bk",function( len, pl )
  44. cur_hat_t = cur_hat_t + 2
  45. end)
  46.  
  47. net.Receive("hat_hotdog_bk",function( len, pl )
  48. cur_hat_h = cur_hat_h + 6
  49. end)
  50.  
  51. net.Receive("hat_hamburger_bk",function( len, pl )
  52. cur_hat_h = cur_hat_h + 7
  53. end)
  54.  
  55. net.Receive("hat_milk_bk",function( len, pl )
  56. cur_hat_t = cur_hat_t + 10
  57. end)
  58.  
  59. net.Receive("hat_soda_bk",function( len, pl )
  60. cur_hat_t = cur_hat_t + 3
  61. end)
  62.  
  63. net.Receive("hat_potato_bk",function( len, pl )
  64. cur_hat_h = cur_hat_h + 1
  65. end)
  66.  
  67. local function setHatPDATA()
  68. net.Start("setHatPDATA")
  69. net.WriteInt( cur_hat_h, 30 )
  70. net.WriteInt( cur_hat_t, 30 )
  71. net.SendToServer()
  72. end
  73.  
  74. hook.Add( "Think", "CurTimeHatT", function()
  75. if CurTime() < cTimeT then return end
  76. if GetConVarNumber( "hat_enable" )==1 then
  77. cur_hat_t = cur_hat_t - 2
  78. setHatPDATA()
  79. --if cur_hat_t<30 then ACTIVATOR:SetHealth(ACTIVATOR:Health()+50) end
  80. if cur_hat_t<100 then Entity(1):TakeDamage( 5 ) end
  81. if cur_hat_t<99 then chat.AddText( Color(255,0,0), "Your too thirsty, your loosing health... ") end
  82. if cur_hat_t<0 then cur_hat_t=0 end
  83. end
  84. cTimeT=CurTime() + 100
  85. end)
  86.  
  87. hook.Add( "Think", "CurTimeHatH", function()
  88. if CurTime() < cTimeH then return end
  89. if GetConVarNumber( "hat_enable" )==1 then
  90. cur_hat_h = cur_hat_h - 2
  91. setHatPDATA()
  92. if cur_hat_h<40 then RunConsoleCommand( "hurtme","5" ) end
  93. if cur_hat_h<40 then RunConsoleCommand( "say","is too hungry, is loosing health..." ) end
  94. if cur_hat_h<0 then cur_hat_h=0 end
  95. end
  96. cTimeH=CurTime() + 160
  97. end)
  98.  
  99. hook.Add( "Think", "CurTimeHatHT", function()
  100. if CurTime() < cTimeR then return end
  101. if GetConVarNumber( "hat_enable" )==1 then
  102. if cur_hat_t>GetConVarNumber( "hat_max_thirst_amount" ) then cur_hat_t=GetConVarNumber( "hat_max_thirst_amount" ) end
  103. if cur_hat_h>GetConVarNumber( "hat_max_hunger_amount" ) then cur_hat_h=GetConVarNumber( "hat_max_hunger_amount" ) end
  104. end
  105. cTimeR=CurTime() + 5
  106. end)
  107.  
  108. net.Receive("setHatPDATAReco",function( len )
  109. cur_hat_hr = net.ReadInt( 30 )
  110. cur_hat_tr = net.ReadInt( 30 )
  111. if cur_hat_hr != cur_hat_h then setHatPDATA() end
  112. if cur_hat_tr != cur_hat_t then setHatPDATA() end
  113. end)
  114.  
  115. net.Receive("setHatReset",function()
  116. cur_hat_h = GetConVarNumber( "hat_max_hunger_amount" )
  117. cur_hat_t = GetConVarNumber( "hat_max_thirst_amount" )
  118. setHatPDATA()
  119. end)
  120.  
  121. hook.Add("HUDPaint", "DrawMyHud", function()
  122. draw.SimpleText("Hunger:"..cur_hat_h,"Whatever",250,10 + 15,Color(255,255,0),1,1)
  123. draw.SimpleText("Thirst:"..cur_hat_t,"Whatever",10+150,10 + 15,Color(255,255,0),1,1)
  124. end)
  125. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement