C4PUNISH:
Battlefield II - CTF game play mode add on to punish players who use C4 or Claymore mines near the main base flag.
This script can be integrated with any CTF style Battlefield II mod, and is available now for Desert Conflict.
Why C4PUNISH?
I am a CTF fanatic, and battlefield is the best. The problem with C4 and claymore mines at the main base flag in CTF mode is that it basically ruins the game. It takes no skill to hide a kilometer away from the base and wait to hear the announcement that your flag has been stolen, and then detonate your C4. Claymore mines are also kind of lame at the flag because they cannot be defused or pre-detonated! You have to offer a human sacrifice to the Claymore if it is near the flag. Now I love both of these weapons everywhere else on the battlefield, or anywhere you like if you are playing conquest mode. If the game had a way to disarm or pre-detonate these it would be a little better, and a range limit on the C4 detonator would be nice, because then at least the bomber would have to remain in the area. However, as we know, Battlefield II didn't offer any solutions (well, it didn't even offer a standard CTF mode!).

Many serious CTF servers have admin's enforcing this rule. As an admin when it happens you have to decide to kick or ban as the only punishment. You can scold players, but that hardly helps a determined smak tard, and what about your server when no admins are on?
With C4Punish installed on your CTF server, players who detonate C4 (or Claymore Mines) and get kills within a specified radius of the flag are punished! They receive a score penalty, and are KILLED. In addition to that it does not count as a death for anyone killed by these weapons in this circumstance. C4Punish will also get tired of repeat offenders and kick them. You can configure the number of violations required to automatically kick and ban players, and also decide if you want to remember the violations from round to round or start fresh every round. C4Punish also features a prominent banner message to remind players that C4 Punish is enforced.
Punished!

I did a lot of research on this, and tried to determine if there was a way in python to disable C4 within the flag radius, and I finally came to the conclusion that it could not be done, at least not with python alone and the current API. I tried moving dropped C4 to a location below ground, but you cannot call obj.setPosition() on a c4_explosives_Projectile, because it is not a PlayerControlObject. I did get to the point where I could find all c4 dropped on the map, but there was nothing that could be done once you located it! So I settled on the warn & punish approach for now.
Earlier versions of this script were more harsh, killing players for switching to C4 or walking within the radius armed with c4 or claymore, and it could even detect C4 on vehicles and blow them up if they got too close. Luckily we play tested that, and decided those features hurt the gameplay so I settled on something that helps enforce the rules that we already use to have a good CTF game, and I deleted that code once and for all!
What exactly will C4PUNISH do?
This script will enforce the following rules:
1) If a player kills (Team Kill or Enemy) using C4 or Claymore Mines within
the C4PUNISH_RADIUS of the main base (unchangeable) flags:
a) the killer does not get points for the kills
b) the killer loses C4PUNISH_PENALTY points from score
c) the victim does not get a 'death' for it
2) Players are kicked for violating more than C4PUNISH_MAX_KILLS_BEFORE_KICK times
3) Players are banned for violating more than C4PUNISH_MAX_KILLS_BEFORE_BAN times
4) Displays a warning every C4PUNISH_BANNER_INTERVAL seconds about the rules
5) When a player is punished a very clear message indicating why is displayed
Beta 1 Release: (right click and Save As! - Install Instructions are in the file.)
This is beta code. It has been tested on a stand alone windows server with dcon 0.20 with multiple players, and seemed to be working well, but to verify I need some feedback or bug reports!
C4PUNISH beta 2 release (February 9, 2006): c4punish.py - Download and Install
Need help with C4 Punish?
Unholyplayground C4Punish Forum <- this is where we hang out
Unholyplayground <- check our server status and play some rounds with us! Coming soon CTF with dedicated STATS!
Need help with python and Battlefield II?
Battlefield II Python & Modding Wiki <- this is a good python community!
Official BF2 Python API Documentation <- this is another good Wiki with a formatted copy of EA's guide.