sandbox server set a limit on hp

is it possible to set a max limit on hp on sandbox?

i was thinking a script like this

function HealthBelow1000()

for k,v in pairs( player.GetAll() ) do
if ply:Health() > 1000 then
ply:SetHealth( 1000 )
end
end

end

hook.Add( “Think”, “HpBelow1000”, HealthBelow1000 )

but idk

Entity:SetMaxHealth
Although as the wiki says, using Health can give the player more health than the max number… you could probably detour it though