[DarkRP] HungerMod only when they are Cooks

Hello i need help, i am trying to have HungerMod activated only when they are some players which are cook.
Because it is activated all the time.

Thanks you,

  • Matthias

Shitty solution, but here.


function HM.Think()
	if not GAMEMODE.Config.hungermod then return end
	if not GAMEMODE.Config.hungerspeed then return end
	if team.NumPlayers(TEAM_COOK) == 0 then return end
	
	for k, v in pairs(player.GetAll()) do
		if v:Alive() and (not v.LastHungerUpdate or CurTime() - v.LastHungerUpdate > 1) then
			v:HungerUpdate()
		end
	end
end
hook.Add("Think", "HM.Think", HM.Think)

Where do i put this TheDivinity?