Is there a way to prevent shooting? Here is the code:
Code: Select all
"""
Shooting a rifle has 2 second cooldown.
by arch_kun
"""
from pyspades.constants import *
from twisted.internet.reactor import callLater, seconds
def apply_script(protocol, connection, config):
class RifleNerfConnection(connection):
cantShoot = 0
def rifleCooldown(self):
self.cantShoot = 1
callLater(2.0, self.recharged)
def recharged(self):
self.cantShoot = 0
def on_shoot_set(self, fire):
if self.weapon == RIFLE_WEAPON and fire:
self.send_chat('ping')
if self.cantShoot == 0 :
self.send_chat('ping2')
self.rifleCooldown()
return connection.on_shoot_set(self, fire)
else:
return False
return protocol, RifleNerfConnection