Talk:Scripts:ClanTkProtection
For those that want to know how to get this to work:
Make a backup of your drive:\Battlefield 2 Server\admin\standard_admin\tk_punish.py
Copy the text into a new file in that same directory and name it tk_punish.py
Open this new tk_punish.py with your favourite text editor Edit this line:
clanmembers = ["|TAG|Bill","|TAG|John","|TAG|Blue"]#clan members to protect
with the names of members you want to protect, typically your admins
For reading the clanmembers out of a file look at Reading Clanmember from a file --Nexus2k 05:11, 8 Jul 2005 (MDT)
Protecting via clantag match
While putting in individual usernames does provide precision control, it doesn't lend itself to maintainability (each time you add a clan member or they change their name, you need to modify the script).
We can change the way this is controlled by changing our method of comparison. Please see below:
protected_clantags = ['*C1*', '*MoG*', '=STFC=']
protected_individuals = ['Friend_of_Our_Clan','My_Brother']
killer = attacker.getName()
for tag in protected_clantags:
if tag in killer: return
for friend in protected_individuals:
if killer == friend: return
Alternately, if you want more control, you can specify a substring to exactly match. For example, tag == killer[:len(tag)] if the tag is in the front, or tag = killer[-len(tag):] if it's in the end. This can be controlled by making a tuple of dics and adding logic to specify checking end or beginning. -- Doulostheos 05:05, 9 Jul 2005 (MDT)
Enhanced clantag & ign match
#killer = "Friend_of_C=CGN=lan"
killer = attacker.getName()
protected_clans = ( {"clan_name":"wicked",
"clan_tag":"w.",
"tag_location":"START"},
{"clan_name":"Men of God",
"clan_tag":"*MoG*",
"tag_location":"END"},
{"clan_name":"Christian Gaming Network",
"clan_tag":"=CGN=",
"tag_location":"ANY"},)
protected_individuals = ["My_Mommy","Friend_of_Clan"]
for clan in protected_clans:
if clan["tag_location"] == "START" and clan["clan_tag"] == killer[:len(clan["clan_tag"])]: return
elif clan["tag_location"] == "END" and clan["clan_tag"] == killer[-len(clan["clan_tag"]):]: return
elif clan["tag_location"] == "ANY" and clan["clan_tag"] in killer: return
for ign in protected_individuals:
if ign == killer: return
-- Doulostheos 09:57, 9 Jul 2005 (MDT)
ClanTkProtection & Ranked servers question
I was looking through the scripts and was wondering if this specific script can be used on ranked servers.