Yep, you should be able to handle this with globals:
https://developer.valvesoftware.com/wiki/Trigger_Events_Between_Levelshttps://developer.valvesoftware.com/wiki/Env_globalhttps://developer.valvesoftware.com/wiki/Logic_autoI don't know much about Source, so I don't know how flexible globals are - but at the very least they can store a yes/no value. So for every action that the player can take (or not take) throughout the mod, you store it as a yes/no value with a name against it. And then in the endings, you can load those values and use logic entities to lock/unlock the endings that you want to happen.
Oh- and also, if this is just for a single map (no level transitions) then you can just use math_counter, which can do the counting you described. You can then use logic_compare to fire events if the counter is less/greater/equal to a certain number.
https://developer.valvesoftware.com/wiki/Math_counterhttps://developer.valvesoftware.com/wiki/Logic_compareFor multiple maps, you could use all of the above - globals to store the variables across level changes, a math_counter to count all the "yes" globals in the ending map(s), and the logic_compare to trigger the appropriate endings.