imported_Jas0n
02-05-2006, 01:19 AM
Hello,
I was just wondering if there are any python scripts which will kick/ban anyone who uses artillery in a game?
I have tried coding one, but no luck :-(
import bf2
import host
import time
kickTime = 10
# Register handlers to receive chat messages and player connections
host.registerHandler('ChatMessage', onChatMessage, 1)
host.registerHandler('PlayerConnect', onPlayerConnect, 1)
def init():
if g_debug: print "initializing tk-punish script"
def onChatMessage(playerID, msgText, channel, flags):
global kickTime
if playerID < 0: return # The server operator can be a potty-mouth if he wants
if msgText.find("[ARTILLERY]") == -1: continue
playerName = bf2.playerManager.getPlayerByIndex(playerID).getNa me()
host.rcon_invoke('game.sayall "Player %s kicked for using arty"'% playerName)
host.rcon_invoke('pb_sv_kick "%s" %i "Using arty"'% (playerName, kickTime))
print ( 'NO ARTY: Player %s kicked for using arty"%s" at %s'% (playerName, word, time.strftime("%a %d-%b-%Y %H:%M")) )
Can anyone help me please?
Thanks very much in adance!
Jase
I was just wondering if there are any python scripts which will kick/ban anyone who uses artillery in a game?
I have tried coding one, but no luck :-(
import bf2
import host
import time
kickTime = 10
# Register handlers to receive chat messages and player connections
host.registerHandler('ChatMessage', onChatMessage, 1)
host.registerHandler('PlayerConnect', onPlayerConnect, 1)
def init():
if g_debug: print "initializing tk-punish script"
def onChatMessage(playerID, msgText, channel, flags):
global kickTime
if playerID < 0: return # The server operator can be a potty-mouth if he wants
if msgText.find("[ARTILLERY]") == -1: continue
playerName = bf2.playerManager.getPlayerByIndex(playerID).getNa me()
host.rcon_invoke('game.sayall "Player %s kicked for using arty"'% playerName)
host.rcon_invoke('pb_sv_kick "%s" %i "Using arty"'% (playerName, kickTime))
print ( 'NO ARTY: Player %s kicked for using arty"%s" at %s'% (playerName, word, time.strftime("%a %d-%b-%Y %H:%M")) )
Can anyone help me please?
Thanks very much in adance!
Jase