[SCRIPT] flipkill

Intended for use on live public servers.
1 post Page 1 of 1
thepolm3
Scripter
Scripter
Posts: 424
Joined: Sat Feb 16, 2013 10:49 pm


What this does is disable killing and enables building. Then it swaps them every 10 minutes (variable).
Code: Select all
from commands import add, admin, alias
from twisted.internet.task import LoopingCall

TELL_EVERY = 40 #seconds, or False
SWAP_TIME = 600 #seconds
BUILDING_FIRST = True

@alias("fk")
def flipkill(self):
    if self.admin: self.protocol.SKAB()
    else: self.protocol.tell_kob(self)
add(flipkill)

def apply_script(protocol,connection,config):
    class FlipKillProtocol(protocol):

        def on_map_change(self,map):
            self.building,self.killing=False,True
            if BUILDING_FIRST: self.SKAB()
            LoopingCall(self.SKAB).start(SWAP_TIME)
            if TELL_EVERY: LoopingCall(self.tell_kob).start(TELL_EVERY)

        def SKAB(self): #swap killing and building
            self.building , self.killing = not self.building , self.building
            self.send_chat("Building is now O%s and killing is O%s" % (["FF","N"][self.building],["FF","N"][self.killing])) #maybe this is a bit TOO compact ;P

        def tell_kob(self, connection = None):
            (connection or self).send_chat("Building is O%s and killing is O%s" % (["FF","N"][self.building],["FF","N"][self.killing])) #maybe this is a bit TOO compact ;P

    return FlipKillProtocol,connection
Attachments
flipkill.py
(1.19 KiB) Downloaded 76 times
1 post Page 1 of 1
Return to “Completed Releases”

Who is online

Users browsing this forum: No registered users and 2 guests