Guest User

Untitled

a guest
Sep 1st, 2016
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. -- Updater
  2. local cook_here = false
  3. hook.Add( "Think", "darkrp_no_cook_no_hunger", function()
  4. cook_here = false
  5. for _,pl in pairs( player.GetAll() ) do
  6. if pl:Team() == TEAM_RESTAURATEUR or TEAM_RESTAURATRICE then
  7. cook_here = true
  8. return
  9. end
  10. end
  11. end )
  12.  
  13. -- Nowadays HungerMod
  14. hook.Add( "hungerUpdate", "darkrp_no_cook_no_hunger", function()
  15. if !cook_here then
  16. return true
  17. end
  18. end )
  19.  
  20. -- Old HungerMod
  21. hook.Add( "PostGamemodeLoaded", "darkrp_no_cook_no_hunger", function()
  22. local HookTable = hook.GetTable()
  23. if istable( HookTable )
  24. and istable( HookTable["Think"] )
  25. and isfunction( HookTable["Think"]["HMThink"] ) then
  26. local old_HMThink = HookTable["Think"]["HMThink"]
  27. hook.Add( "Think", "HMThink", function( ... )
  28. if cook_here then
  29. return old_HMThink( ... )
  30. end
  31. end )
  32. end
  33. end )
Add Comment
Please, Sign In to add comment