Add autojailing scripts for PK, activated by DMs.
git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@14535 282e977c-c81d-0410-88c4-b93c2d0d6712master
parent
0a6b0b1664
commit
68094029af
|
@ -0,0 +1,18 @@
|
|||
import Crossfire
|
||||
|
||||
who = Crossfire.WhoAmI()
|
||||
|
||||
if who.DungeonMaster:
|
||||
value = Crossfire.ScriptParameters()
|
||||
dict = Crossfire.GetSharedDictionary()
|
||||
if value == '1':
|
||||
dict['autojail'] = 1
|
||||
who.Message('Autojail enabled')
|
||||
elif value == '0':
|
||||
dict['autojail'] = 0
|
||||
who.Message('Autojail disabled')
|
||||
else:
|
||||
autojail = 0
|
||||
if 'autojail' in dict and dict['autojail'] == 1:
|
||||
autojail = 1
|
||||
who.Message('Autojail is %d'%autojail)
|
|
@ -0,0 +1,31 @@
|
|||
#
|
||||
# This module will automaticall arrest players killing other players,
|
||||
# provided the option was activated by a DM through 'autojail 1'.
|
||||
# Note the settings defaults to 0 and isn't kept during server resets.
|
||||
|
||||
import Crossfire
|
||||
|
||||
|
||||
def check_autojail():
|
||||
killer = Crossfire.WhoIsActivator()
|
||||
|
||||
if killer.Type != Crossfire.Type.PLAYER or killer.DungeonMaster:
|
||||
return
|
||||
|
||||
dict = Crossfire.GetSharedDictionary()
|
||||
if not 'autojail' in dict or dict['autojail'] != 1:
|
||||
return
|
||||
|
||||
victim = Crossfire.WhoAmI()
|
||||
killer.Message('You are auto-jailed for PKing %s'%victim.Name)
|
||||
ret = killer.Arrest()
|
||||
if ret == 0:
|
||||
msg = '%s was auto-jailed for PKing %s'%(killer.Name, victim.Name)
|
||||
else:
|
||||
msg = 'Failed to auto-jail %s for PKing %s, code %d'%(killer.Name, victim.Name, ret)
|
||||
players = Crossfire.GetPlayers()
|
||||
for player in players:
|
||||
if player.DungeonMaster:
|
||||
player.Message(msg)
|
||||
|
||||
check_autojail()
|
|
@ -0,0 +1,2 @@
|
|||
import Crossfire
|
||||
Crossfire.RegisterCommand("autojail", "/python/commands/autojail", 0)
|
|
@ -0,0 +1,7 @@
|
|||
import Crossfire
|
||||
|
||||
dict = Crossfire.GetSharedDictionary()
|
||||
|
||||
if 'autojail' in dict and dict['autojail'] == 1:
|
||||
activator = Crossfire.WhoIsActivator()
|
||||
activator.Message("Notice: killing another player will automatically send you to jail.")
|
Loading…
Reference in New Issue