I know this is older than old, but I think posting an update to this isn't a bad idea
The above code is great, but there may be a way that wasn't available back when this thread was written.
For one of my plugins, I needed to capture when the map ended due to a player reaching the set frag limit (say 100).
is what I needed.
Just thought I'd pass this along.